View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Sheet Name Confusion

Hi George

If you use the code name(the first one) in your code
and protect your VBA code then people can't change this name.
They can only change the tab name

So If you use this
Sheet1.Range("a1").Value = 100
this code will always work

If you use this
Sheets("Sheet1").Range("a1").Value = 100

And you change the Tab name your don't work anymore



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"George B" wrote in message ...
I have a workbook which I have created on a single sheet which was
originally titled "Sheet1". I have since changed the name to "Data". I
then added a second sheet, which Excel has titled "Sheet1". As long as I
restrict myself to Excel, there is no confusion. But when I switch to the
Visual Basic Editor, it lists my sheets as Sheet1(Data) and Sheet2(Sheet1).

Apparently, there are two sets of names. Do I need to use one set when
programming in VBA, and the other for formulas in cells? What's going on,
and how does an experienced macro programmer deal with this situation?

George Borrmann