Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default specific worksheet can't be constant?

I have a series of worksheets in a workbook and a slew of macros that
work with them. One particular worksheet is used in all the macros.
I've looked around here and in Walkenbach, but can't find a way to
declare that worksheet name a Public variable or constant. It appears I
will have to start each macro with:

Set CtyExtr = ActiveWorkbook.Sheets("County Extract")

Is there a way to do this project wide?
Thanks for your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default specific worksheet can't be constant?

Try:

Dim CtyExtr As Worksheet

Sub FirstMacro()
Set CtyExtr = ActiveWorkbook.Sheets("Sheet1")

End Sub

Code should be in the ThisWorkbook module.

"davegb" wrote:

I have a series of worksheets in a workbook and a slew of macros that
work with them. One particular worksheet is used in all the macros.
I've looked around here and in Walkenbach, but can't find a way to
declare that worksheet name a Public variable or constant. It appears I
will have to start each macro with:

Set CtyExtr = ActiveWorkbook.Sheets("County Extract")

Is there a way to do this project wide?
Thanks for your help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default specific worksheet can't be constant?

You can just refer to the sheet by its code name. The code name is defined in
the properties in the VBE at the very top of the list beside (Name). The
default is Sheet1, Sheet2, ... Change it to something more descriptive like
shtCtyExtr and you will be able to refer to it the same way you refered to
the object you were createing.

shtCtyExtr.Select

--
HTH...

Jim Thomlinson


"davegb" wrote:

I have a series of worksheets in a workbook and a slew of macros that
work with them. One particular worksheet is used in all the macros.
I've looked around here and in Walkenbach, but can't find a way to
declare that worksheet name a Public variable or constant. It appears I
will have to start each macro with:

Set CtyExtr = ActiveWorkbook.Sheets("County Extract")

Is there a way to do this project wide?
Thanks for your help.


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
mutliply a worksheet by a constant Eduardo Excel Discussion (Misc queries) 2 July 9th 09 03:48 AM
Creating a row that is constant and updatable across all worksheet Global Sys Admin Excel Discussion (Misc queries) 5 October 9th 08 11:25 PM
If in specific cell in any worksheet but worksheet one add to spec LiveUser Excel Worksheet Functions 3 January 24th 08 11:26 PM
Constant loan payments vs. constant payments of principal lalli945 Excel Worksheet Functions 3 December 20th 06 10:33 PM
hyperlink to a specific worksheet Roger Excel Discussion (Misc queries) 2 November 1st 06 03:25 PM


All times are GMT +1. The time now is 02:20 AM.

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

About Us

"It's about Microsoft Excel"