Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Worksheet and workbook name question.

ans = Msgbox "Is the sheet we need to work with active? If not, " &
_ vbNewline & "then answer no, select the sheet and rerun the macro"

if ans = vbNo then exit sub

With Activesheet




End With


or

before distributing the sheet

activesheet.Range("IV1").Numberformat = """the sheet"""


to check

for each sh in thisworkbook.worksheets
if Instr(1,sh.Range("IV1").Numberformat, "the sheet", vbTextCompare) then
set thSheet = sh
exit for
end if
Next


or create a defined name that refers to the sheet (and make it hidden)

range("Secret").Parent.Name

--
Regards,
Tom Ogilvy



"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
Copy worksheet from one workbook to a master workbook mvannatta Excel Worksheet Functions 3 April 15th 09 08:32 PM
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
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 02:48 AM.

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"