Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Control on different sheet than the executable

I need to replace ActiveSheet with the sheet name but I want the user to be
able to change the worksheet name without messing up the macro. Any
suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Control on different sheet than the executable

possibly use the codename of the sheet. In the project explorer you see two
names

sheet1 (sheet1)

sheet1 is the code name

the name in () is the tab name.

you use the code name like

sheet1.Range("A1")

and the tab name you already would be familiar with
Worksheets("Sheet1").Range("A1")

if you renamed the tab to Dog it would be
Sheet1.Range("A1")
Worksheets("Dog").Range("A1")

see - the codename doesn't change.

--
Regards,
Tom Ogilvy


"BearTrap3" wrote:

I need to replace ActiveSheet with the sheet name but I want the user to be
able to change the worksheet name without messing up the macro. Any
suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Control on different sheet than the executable

What you want to use is the code name...

sheets("Sheet1").select
is the same as
Sheet1.Select
If they change the tab name then the first statement would bomb but the
second statement would not since the user has no ability to mess with the
code name...
In the VBE you will see all of the sheets listed something like this

Sheet1(mysheet)
Sheet1 is the code name and mysheet is the tab name.
You can change the code name by looking at the properties of the sheet and
the first item (Name) is the code name. If you change this then you will see
shtWhatever(mysheet) in project explorere in the VBE... Now you would refer
to the sheet as
shtWhatever.Select

--
HTH...

Jim Thomlinson


"BearTrap3" wrote:

I need to replace ActiveSheet with the sheet name but I want the user to be
able to change the worksheet name without messing up the macro. Any
suggestions?

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
Excel into executable MrBT Excel Worksheet Functions 2 May 1st 08 03:05 AM
VB executable Dan Excel Programming 2 October 11th 05 06:23 PM
Convert Multi-Sheet Workbook to Standalone Executable Dave Peterson Excel Discussion (Misc queries) 0 April 4th 05 01:45 PM
macro to executable annette2002[_3_] Excel Programming 6 June 16th 04 12:57 PM


All times are GMT +1. The time now is 12:53 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"