Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
setting a copied worksheet
Hello,
This works for me: Set MyWorksheet = Worksheets.Add This doesn't: Set MyWorksheet = Worksheets("Sheet1").Copy Is there a way to do the set and copy on one line or do I copy and then set on the next line? Thanks, Doug Glancy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
setting a copied worksheet
Doug,
The Copy method doesn't return anything, so you can't set a variable to its result. You need two lines of code Dim MyWorksheet As Worksheet Worksheets("SHeet1").Copy after:=Worksheets(3) Set MyWorksheet = ActiveSheet -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Doug Glancy" wrote in message ... Hello, This works for me: Set MyWorksheet = Worksheets.Add This doesn't: Set MyWorksheet = Worksheets("Sheet1").Copy Is there a way to do the set and copy on one line or do I copy and then set on the next line? Thanks, Doug Glancy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
setting a copied worksheet
Thanks, Chip. That's what I had done, but your concise explanation helps me
understand it better. Doug "Chip Pearson" wrote in message ... Doug, The Copy method doesn't return anything, so you can't set a variable to its result. You need two lines of code Dim MyWorksheet As Worksheet Worksheets("SHeet1").Copy after:=Worksheets(3) Set MyWorksheet = ActiveSheet -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Doug Glancy" wrote in message ... Hello, This works for me: Set MyWorksheet = Worksheets.Add This doesn't: Set MyWorksheet = Worksheets("Sheet1").Copy Is there a way to do the set and copy on one line or do I copy and then set on the next line? Thanks, Doug Glancy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can data be copied from one worksheet to another? | Excel Worksheet Functions | |||
how do i restore a copied over worksheet | Excel Worksheet Functions | |||
How to protect a worksheet from being copied to another worksheet | Excel Discussion (Misc queries) | |||
Get the name of a newly copied worksheet | Excel Programming | |||
How name a copied worksheet? | Excel Programming |