View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Sheet Code Name vs. Sheet Name

My 2 cents worth:

In workbooks that the user may change by inserting new worksheets, removing
old ones, moving data to newly inserted worksheets, I generally avoid using
the Code Name for a worksheet. I use the tab name instead. I might rewrite
your code as follows:

Dim wsAAA as Worksheet
Dim wsBBB as Worksheet

With ActiveWorkbook
Set wsAAA = .Worksheets("AAA")
Set wsBBB = .Worksheets("BBB")
End With

'Continue processing using wsAAA and wsBBB for your references.

This allows the users to move worksheets around, destroy the Code Names,
etc. all they want. Your code will still work. Just make sure that they
don't change the tab name from AAA to AA1, for example. This is a lot
easier for them to understand than trying to maintain the Code Names.

--
Regards,
Bill Renaud