ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting worksheets without hardcoding (https://www.excelbanter.com/excel-programming/297213-selecting-worksheets-without-hardcoding.html)

jeff

Selecting worksheets without hardcoding
 
Hi,

You dont say how you want to select the sheets....

If your thinking macro code, look at this little
bit for ideas. Shows the way to get the number
and then get the name of each. You can put your
combinations into an array and swing through that?

Sub sheetsnames()
x = Sheets.Count
For j = 1 To x
nam = Sheets(j).Name
MsgBox (nam)
Next j
End Sub

jeff
-----Original Message-----
How can I select multiple sheets without coding the

sheetnames?
For instance, I have 10 branches servicing 50 states.
Branch 1 serves CA and AZ, Branch 2 serves UT,NV,MT,ID,

etc.
I have a sheet with a lookup file that looks like this:
1 AZ
1 CA
2 UT
2 NV
2 MT
How can I select these sheets in an array upon change of

the branch number? Using the recorder, it always wants to
hardcode the sheet name. I would like to save all the
states and a summary page for each branch.

Thanks!



.



All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com