View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Control on different sheet than the executable

What you want to use is the code name...

sheets("Sheet1").select
is the same as
Sheet1.Select
If they change the tab name then the first statement would bomb but the
second statement would not since the user has no ability to mess with the
code name...
In the VBE you will see all of the sheets listed something like this

Sheet1(mysheet)
Sheet1 is the code name and mysheet is the tab name.
You can change the code name by looking at the properties of the sheet and
the first item (Name) is the code name. If you change this then you will see
shtWhatever(mysheet) in project explorere in the VBE... Now you would refer
to the sheet as
shtWhatever.Select

--
HTH...

Jim Thomlinson


"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?