ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Navigate Sheets using In-Sheet Combo Boxes (https://www.excelbanter.com/excel-programming/380632-navigate-sheets-using-sheet-combo-boxes.html)

imitk

Navigate Sheets using In-Sheet Combo Boxes
 
I've got a menu ComboBox and I want selecting an item to activate a
corresponding sheet in the workbook. Thinking of writting a macro that
calls several subsequent macros (already written) that activate the
sheets, but I'm a little fuzzy on coding for In-sheet controls.
Suggestions?

imitk


Ken

Navigate Sheets using In-Sheet Combo Boxes
 
It may not be exactly what you want, but Bill Gates already gave us
something that does pretty much what you have described. If you right
click on the arrow keys that are jst to the left of the sheet names you
get basically a list box with all the sheets. You pick the on you want
and spare yourself the macro writing. If you really want it in a
Combobox, you can insert a combobox from the Control Toolbar on your
worksheet, and associate this code with it

Private Sub ComboBox1_Click()
ws = ComboBox1.ListIndex
Worksheets(ws + 1).Activate
End Sub

Private Sub ComboBox1_GotFocus()
ComboBox1.Clear
For Each ws In Worksheets
ComboBox1.AddItem ws.Name
Next ws
End Sub

Good luck.

Ken
Norfolk, Va




imitk wrote:
I've got a menu ComboBox and I want selecting an item to activate a
corresponding sheet in the workbook. Thinking of writting a macro that
calls several subsequent macros (already written) that activate the
sheets, but I'm a little fuzzy on coding for In-sheet controls.
Suggestions?

imitk




All times are GMT +1. The time now is 03:15 AM.

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