View Single Post
  #9   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

On Feb 10, 2:55 pm, Dave Peterson wrote:
You could add a worksheet level name (hidden) to each sheet and then use that.

But it makes much more sense to me to use the codename.



"Michael.Tarnowski" wrote:

On Feb 6, 1:25 am, Dave Peterson wrote:
If this was meant for me, I don't understand the question.


"Michael.Tarnowski" wrote:


<<snipped


Gary, Dave -- nice suggestions, I will work with that.
But, how should I proceed if I have define global variables for
different worksheets? -- e.g.
const wsShID_1 = "Config"
const wsShID_2 = "Sheet 1"
and so one... ?
Michael


--


Dave Peterson


To make my point clear:
If I want to address the worksheets by global constants, I would use
the (user)names of the sheets / or the sheet index, like
const worksheetID = 1
or
const worksheetID = "MySheet"


Is there a function in VBA to determine the values (sheet names or
indices) for the constants, like
const worksheetID = foo(...)


Michael


--

Dave Peterson


Thank you Dave for sharing your insights.
Michael