Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting worksheets without hardcoding

If the sheet name is the branch number, you could use

Worksheets(Activecell.Value).Activate


If not you could use something like

Select Case Actvecell.Value
Case 1: Worksheets("Western").Activate
Case 2: Worksheets("Mid").Activate
'etc
End Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dumbguy" wrote in 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!





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting worksheets without hardcoding

Can I activate more than one at a time though? What I want to do is for instance select CA,AZ and Branch 1 Summary at the same time, and then copy to a new workbook for distribution to branch 1. The code in the recorder looks like this

Sheets(Array("Branch 102 Totals", "AL", "FL", "GA", "MS", "102 Competition")).Cop
ChDir "V:\Branch and Corporate\BR102
ActiveWorkbook.SaveAs Filename:=
"V:\Branch and Corporate\BR102\Branch102BARModel.xls", FileFormat:=xlNormal,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
CreateBackup:=Fals

What I can't figure out is how to create the Sheets(Array) Function without hardcoding the names in there. Since we periodically re-assign states, I want Excel to be able to pick to right sheets to save to each branch based on a lookup table rather than editing the code every time

Thanks

Thanks

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
selecting several open worksheets Annette Excel Discussion (Misc queries) 8 September 2nd 08 11:03 PM
Selecting across worksheets JMS Excel Discussion (Misc queries) 1 July 14th 05 10:44 PM
How to open a workbook from a template without hardcoding the path Michael Turner Excel Programming 0 November 21st 03 12:08 AM
How to open workbook from template without hardcoding Michael Turner Excel Programming 2 November 20th 03 10:29 PM
how to open workbook without hardcoding path Michael Turner Excel Programming 3 November 20th 03 12:12 PM


All times are GMT +1. The time now is 05:11 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"