View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default copy from one workbook to another?

take the parens off myrange2


myRange1.Copy Destination:=myRange2

You dequalify it as an object when you put the parens around it.

--
Regards,
Tom Ogilvy

"keithb" wrote in message
...
what is the code for copying a range of rows and columns from one workbook
to different rows and columns in a different workbook? The last line of

code
shown below results in "Runtime Error 1004, Application-defined or
object-defined error."

Workbooks(sWB1).Activate
Set myRange1 =
ActiveWorkbook.Worksheets("Sheet1").Range("A1").Cu rrentRegion.Columns(1)
myRange1.Copy
Workbooks(sWB2).Activate
Set myRange2 =
ActiveWorkbook.Worksheets("Sheet1").Range("A1").Cu rrentRegion
myRange2.Delete
Set myRange2 = ActiveWorkbook.Worksheets("Sheet1").Range("A1")
myRange1.Copy (myRange2)

Thanks,

Keith