View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default problem copy/pasting pages.

Another way

worksheets(Array("Data1","Data2")).Copy

--
Regards,
Tom Ogilvy


"Monika Weber" wrote in message
...
Hi rut,

Can someone give me code to copy a worksheet from one workbook to a new
workbook? I need to copy 2 sheets. When I try to copy one
(Application..Worksheets("Data1").Copy) it seems to automatically
create a new workbook called "Book1". When I try to copy the second
sheet it creates another workbook. I need to paste the second sheet
into book1 also.


try something like this:

Sub test()
Workbooks("Test.xls").Worksheets("Data1").Copy _
Befo=Workbooks("Book1.xls").Worksheets(1)
Workbooks("Test.xls").Worksheets("Data2").Copy _
Befo=Workbooks("Book1.xls").Worksheets(1)
End Sub

--
Greetings,
Monika Weber [Microsoft MVP für Excel]
http://www.jumper.ch (Office Help Desk)