View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Michael.Tarnowski Michael.Tarnowski is offline
external usenet poster
 
Posts: 95
Default How to reference Worksheets in VBA properly

Hi experts in the community,

as VBA newbie I know there are two possibilities to reference a
worksheet in an application:

Example: ... Worksheets(workSheetID).Range("openIcon").Value ...

where workSheetID is either:

a.) a numerical ID, the sheet index
or
b.) a string, the name of the sheet as it is displayed in the sheet
tabs.

Question: how can I reference the sheet in VBA without being
intertwined by either sheet name changes or insertions of new sheets
by the user?

Thanks for your help
Have a nice day
Michael