Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet and workbook name question.
And you can always refer to the workbook containing the macro that is
running with the ThisWorkbook keyword as in: ThisWorkbook.Sheet1.Range("A1") TH On 4/19/04 14:56, in article , "Bob Phillips" wrote: 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet and workbook name question.
if the user changes either the object name or the sheet's tab position
I interpreted the object name to be the codename, but you may be right since he didn't mention the tab name. -- Regards, Tom Ogilvy "Bob Phillips" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet and workbook question | Excel Worksheet Functions | |||
Copy Data from Workbook into specific Worksheet in other Workbook? | Excel Discussion (Misc queries) | |||
copy worksheet from closed workbook to active workbook using vba | Excel Worksheet Functions | |||
Worksheet and workbook name question. | Excel Programming | |||
Question for Experts: Opening workbook with workbook references | Excel Programming |