Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet and workbook question Amedea_C[_2_] Excel Worksheet Functions 1 August 12th 08 09:12 PM
Copy Data from Workbook into specific Worksheet in other Workbook? kingdt Excel Discussion (Misc queries) 1 March 16th 06 06:55 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Worksheet and workbook name question. Tom Ogilvy Excel Programming 0 April 19th 04 09:30 PM
Question for Experts: Opening workbook with workbook references Chris Excel Programming 0 September 11th 03 07:05 PM


All times are GMT +1. The time now is 08:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"