View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Set Worksheet Name

Declare the variables wksCurrent and wksKey as public variables before any
macros (type Worksheet), and in the first module set them as you show, and
it will remain available for all macros.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Noemi" wrote in message
...
Hi
Is it possible to set the names of each worksheet in a module so I can

refer
to it within the sheets itself.

ie
Set wksCurrent = worksheets("Sheet1")
set wksKey = worksheets("Sheet2")
etc

The above is what I would like to declare and have set in a module and

then
in the worksheets i would use

wksCurrent.select
wksKey.visible = true
etc.

I am hoping that I dont need to keep adding the Set wksCurrent =
Worksheets("Sheet1") etc for each private or public sub.