View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Monika Weber Monika Weber is offline
external usenet poster
 
Posts: 6
Default problem copy/pasting pages.

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)