Copy from one to another

  • Thread starter Thread starter ianripping
  • Start date Start date
I

ianripping

Can a macro copy the Information in Book1 Sheet1 Range A:B to Book 2
Sheet1 Range A:B with out Book1.xls being open?
 
I've just figured it out. Here it is for those who wondered: -

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 15/01/2004 by Ian
'

'
Workbooks.Open Filename:= _
"Book2.xls"
Range("A:B").Select
Selection.Copy
Windows("Book1").Activate
Range("A:B").Select
ActiveSheet.Paste
Windows("Book2.xls").Activate
ActiveWindow.Close
Range("A1").Select
MsgBox ("Completed Copying")
End Su
 
Ian,

So you figured it out as no then?

Your code can be substantiually shortened

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 15/01/2004 by Ian
'

Workbooks.Open Filename:= "Book2.xls"
Range("A:B").Copy Destination:=Workbooks("Book1").Range("A:B")
Windows("Book2.xls").Close
MsgBox ("Completed Copying")
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top