MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 16th, 2002, 04:05 PM   #1
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Is there a macro that choose which worksheet to view? Maybe a combo box on each page? BUT I need those combo boxes to appear automatically on each worksheet and be popoulated/updated with the worksheets automatically since this workbook is updated continually.

And YES, I know you can use the tabs at the bottom, but that can be cumbersome with a lot of worksheets.

Thanks!
Cosmos75 is offline   Reply With Quote
Old Apr 16th, 2002, 04:42 PM   #2
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

How about creating a summary page...

You can download ASAP at the following link:
http://asap-utilities.com/
And create a summary sheet.

Or you can make your own. Try the following code in the Module for ThisWorkbook:
Code:
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In Worksheets
Worksheets("Summary").Hyperlinks.Add Anchor:=Worksheets("Summary").Cells(ws.Index, 1), Address:="", SubAddress:=ws.Name & "!A1", TextToDisplay:=ws.Name
Next
End Sub
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 16th, 2002, 05:07 PM   #3
Damon Ostrander
MrExcel MVP
 
Damon Ostrander's Avatar
 
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
Default

Hi Cosmos75,

There actually is a built-in capability that is not well advertised to do this. Simply right-click on the "Workbook tabs" toolbar and a worksheet list shortcut will pop up. This toolbar is the one that shows the worksheet tabs, but you have to click on the left end of the toolbar where the go right/left buttons are (i.e., right-click on one of these buttons).
__________________
Keep Excelling.

Damon

VBAexpert Excel Consulting
(My other life: http://damonostrander.com )
Damon Ostrander is offline   Reply With Quote
Old Apr 16th, 2002, 05:17 PM   #4
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Damon Ostrander!!

That's exactly what I wanted!! Is there code to call that from a Macro? Tried recording a macro but if only has a line to select the sheet I selected from the pop-up box.

Al Chara,

I actually have a summary page that is linked to all other worksheets. And the other worksheets are linked back to the summary page. I wanted a way to jump to any page from ANY other page. Hopefully, I can automatically add a button to each worksheet to be able to bring up that pop-up box that Damon Ostrander was talking about!

PLEASE LET THE BE CODE FOR THAT!!

Any ideas on automatically adding a button to each workshet to activate that pop-up box? (assuming there's code for that pop-up box)
Cosmos75 is offline   Reply With Quote
Old Apr 17th, 2002, 10:13 AM   #5
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Anyone know?
Cosmos75 is offline   Reply With Quote
Old Apr 17th, 2002, 10:19 AM   #6
Damon Ostrander
MrExcel MVP
 
Damon Ostrander's Avatar
 
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
Default

Hi again Cosmos,

The code:

CommandBars("Workbook tabs").ShowPopup

will pop up the shortcut menu for worksheet selection.

If you want to automatically add a button to each worksheet in your workbook that will pop up this menu, just use the following macro (AddButtons). This example adds each button in cell B4. Just change this reference (one place) to put the button in any cell you choose. It does not add buttons to other types of sheets (e.g., Chart sheets), but this would be easy to do as well.

Sub SelectWorksheetMenu()
CommandBars("Workbook tabs").ShowPopup
End Sub

Sub AddButtons()
Dim WS As Worksheet
Dim C As Range 'The cell where the button will be placed
Dim Width As Single 'The button width
For Each WS In Worksheets
Set C = WS.[B4] 'put button in cell B4
If C.Width > 60 Then Width = C.Width Else Width = 60
With WS.Buttons.Add(C.Left, C.Top, Width, C.Height)
.OnAction = "SelectWorksheetMenu"
.Characters.Text = "Select Sheet"
.Characters.Font.Size = 8
End With
Next WS
End Sub
__________________
Keep Excelling.

Damon

VBAexpert Excel Consulting
(My other life: http://damonostrander.com )
Damon Ostrander is offline   Reply With Quote
Old Apr 17th, 2002, 10:23 AM   #7
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Guru Damon Ostrander!!!!

THANK YOU!!!!
Cosmos75 is offline   Reply With Quote
Old Apr 17th, 2002, 10:32 AM   #8
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Since you have a summary page, why don't you put a combobox on each page with the ListFillRange equal to Summary!A:A. Then use the following code to activate the selected worksheet:

Private Sub ComboBox1_Change()
Worksheets(ComboBox1.Value).Select
End Sub

Edit as needed and post with further questions.
__________________
Kind regards,

Al Chara
Al Chara is offline   Reply With Quote
Old Apr 17th, 2002, 12:50 PM   #9
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Al Chara,

That sounds like a good idea. The only thing is I need the combo-box to show up on every page and pages are added regularly. SO, I'd have to figure out how to automatically add a combo box to each sheet (except summary sheet) and I'm not very good at VBA so far.

Also, would your code be more efficient or would Damon's be more efficient?
Cosmos75 is offline   Reply With Quote
Old Apr 17th, 2002, 01:05 PM   #10
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Damon,

One question, if I have to click add button macro every time I add a sheet, the sheets that already have a button will have an extra button on top of the existing button.

Is there a way to check if a button already exists as to not have a redundant button?

I apologize about this. I don't mean to sound ungrateful cause believe me I AM VERY GRATEFUL for all the help.
Cosmos75 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes