Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable VBA Worksheet Name
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable VBA Worksheet Name
Hi Dave,
Try something like: '========= Public Sub Tester() Dim SH As Worksheet For Each SH In ActiveWorkbook.Worksheets 'do something, e.g.: MsgBox SH.Name Next SH End Sub '<<========= BTW, it is rarely necessary to select a sheet; mot operations can be performed using the SH object variable. --- Regards, Norman "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Link variable data from one worksheet to another worksheet? | New Users to Excel | |||
Variable worksheet name (tab) linked to cell in same worksheet | Excel Worksheet Functions | |||
Looking up a variable in one worksheet and copying information from another column to another worksheet?? | Excel Discussion (Misc queries) | |||
Variable worksheet name | Excel Worksheet Functions | |||
Assigning worksheet to worksheet variable | Excel Programming |