View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default 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