View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default 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