View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul C Paul C is offline
external usenet poster
 
Posts: 269
Default Change Sheet references in code?

Try

ThisWorkbook.Sheets(2).Activate

you can also eliminate the ThisWorkbook (it is implied)

Sheets(2).Activate
--
If this helps, please remember to click yes.


"Bassman62" wrote:

I have some old code that refers to sheet names and I'd like to change these
to the sheet code names.
However, apparently code names are objects of a different type than sheet
Names.
Here's an example of what I'm trying to do:
Change
ThisWorkbook.Sheets("Report").Activate
To
ThisWorkbook.Sheet2.Activate 'Error: Method or Data Member not
found.
This seems elementary but I can't seem to get the syntax correct.
How can I refence a code name of a particula workbook?
Thanks.