Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. Thanks, rut |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pasting PDF pages into Worksheets | Excel Discussion (Misc queries) | |||
Copy and Pasting | Excel Discussion (Misc queries) | |||
Copying and Pasting from Web Pages | Excel Discussion (Misc queries) | |||
Copy and Pasting Every Third Row | Excel Worksheet Functions | |||
Copy pasting problem | Excel Discussion (Misc queries) |