View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Variable VBA Worksheet Name

Dim wrksheetnum as Long
Dim wrksheetname as String
wrksheetnum = (loop through worksheet numbers)
wrksheetname = "S" & wrksheetnum

Worksheets(wrksheetname).activate

--
Regards,
Tom Ogilvy


"Dave" wrote in message
oups.com...
Hi,

Can anyone tell me how to generate a variable VBA worksheet name so I
can search through the set up sheets.

Basically the VBA names of my sheets are S1 to S10 allowing me to use
the

S1.Activate etc...

How can I set up the Sheet name to be something like:

wrksheetnum = (loop through worksheet numbers)
wrksheetname = "S" & wrksheetnum

wrksheetname.activate

loop etc...

How do I get the wrksheetname bit to work?

Thanks
David