Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi
i need to create copy of a standard template worksheet and then add data to it i have done the data part, but for some reason i cant seem to get the code for creating a copy of my standard template worksheet here is what i am doing: Dim tosheet as Worksheet Dim copysheet As Worksheet Set copysheet = current.Worksheets("PC J12-1") Set tosheet = copysheet.Copy Now, my compiler complains: "expression or object expected" when it encounters the Copy function. I don't understand what it wants, because according to Microsoft's library, this should work. Can someone suggest a solution to this? Or another better way of creating a copy of an existing worksheet? Thanks in advance. Gobind |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It depnds on where you want the copy.
To keep it in the current workbook copysheet.Copy Befo=Sheets(1) Set tosheet = ActiveSheet To move it to a new workbook copysheet.Copy Set tosheet = ActiveSheet HTH, Bernie MS Excel MVP "Gobind" wrote in message oups.com... hi i need to create copy of a standard template worksheet and then add data to it i have done the data part, but for some reason i cant seem to get the code for creating a copy of my standard template worksheet here is what i am doing: Dim tosheet as Worksheet Dim copysheet As Worksheet Set copysheet = current.Worksheets("PC J12-1") Set tosheet = copysheet.Copy Now, my compiler complains: "expression or object expected" when it encounters the Copy function. I don't understand what it wants, because according to Microsoft's library, this should work. Can someone suggest a solution to this? Or another better way of creating a copy of an existing worksheet? Thanks in advance. Gobind |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding a copy of an open window to an excel worksheet | Excel Worksheet Functions | |||
Adding macro code to a new worksheet | Excel Programming | |||
Adding Macro to Button on WOrksheet | Excel Discussion (Misc queries) | |||
Dynamically adding a macro to a new worksheet | Excel Programming | |||
How? Macro to copy range to new worksheet, name new worksheet, loop | Excel Programming |