View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Worksheet and workbook name question.

With worksheet, you can use the codename property. If you go into the VBE,
and look at the Microsoft Excel Objects, the codename is the left of the 2
name pairs. It is usually of the form Sheet1(Sheet1), but if the user
changes the name to mySheet, it would show as Sheet1(mySheet).

You would address the sheet like so

Sheet1.Range("A1")

etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mark" wrote in message
...
What is the proper way to refer to a workbook and/or a worksheet within

VBA such that the code remains unaffected if the user changes either the
object name or the sheet's tab position?

Thanks

Mark