View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Control on different sheet than the executable

possibly use the codename of the sheet. In the project explorer you see two
names

sheet1 (sheet1)

sheet1 is the code name

the name in () is the tab name.

you use the code name like

sheet1.Range("A1")

and the tab name you already would be familiar with
Worksheets("Sheet1").Range("A1")

if you renamed the tab to Dog it would be
Sheet1.Range("A1")
Worksheets("Dog").Range("A1")

see - the codename doesn't change.

--
Regards,
Tom Ogilvy


"BearTrap3" wrote:

I need to replace ActiveSheet with the sheet name but I want the user to be
able to change the worksheet name without messing up the macro. Any
suggestions?