Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel,microsoft.public.access.modulesdaovba
external usenet poster
 
Posts: 6
Default Drop Down Menu Options? Need a PRO

Big thanks to groups user huntermcg for this find.

I have entered this into my "ThisWorkbook" -

Private Sub Workbook_Open()
Dim sh As Object

On Error Resume Next
Application.CommandBars("Navigate XL-Dennis").Delete
Application.CommandBars("Navigate Sheets").Delete
On Error GoTo 0

With Application.CommandBars.Add("Navigate Sheets", , False, True)

With .Controls.Add(msoControlButton)
..TooltipText = "Move Back"
..FaceId = 1017
..OnAction = "Move_Back"
..BeginGroup = True
End With

With .Controls.Add(msoControlDropdown)
For Each sh In ThisWorkbook.Sheets
..AddItem sh.Name
Next sh
..TooltipText = "SheetNavigate"
..OnAction = "Sheet_Navigate"
End With

With .Controls.Add(msoControlButton)
..TooltipText = "Move next"
..FaceId = 1018
..OnAction = "Move_Next"
End With

..Protection = msoBarNoCustomize
..Position = msoBarFloating
..Visible = True
End With
End Sub


and then I entered this into a module -


Private Sub Sheet_Navigate()
Dim stActiveSheet As String

With CommandBars.ActionControl
stActiveSheet = .List(.ListIndex)
ThisWorkbook.Sheets(stActiveSheet).Activate
End With
End Sub

Private Sub Move_Back()
On Error Resume Next
ActiveSheet.Previous.Select
End Sub

Private Sub Move_Next()
On Error Resume Next
ActiveSheet.Next.Select
End Sub


This created a neat little drop down menu for sheet navigation.
(thanks to Bob Phillips for the code at
http://www.excelforum.com/newreply.p...te=1&p=1358771)


QUESTION -

I've applied this to a project of mine and it works great.

Although with my project I have a workbook with over 250 sheets :-)

Is their a way to limit the amount of sheets displayed in the drop
down box?

also if the above is possible...

Is their a way to have different set of sheets displayed for each
worksheet?

For example, on "sheet 1", the drop down only displays sheets 2-5.
Upon the users arrival to sheet 4, the drop down menu displays sheets
30-50.

Thanks for the help in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel,microsoft.public.access.modulesdaovba
external usenet poster
 
Posts: 2
Default Drop Down Menu Options? Need a PRO

That sounds to me like you would want two drop-downs. One for the initial
sheet selected and one to display the extra sheets once the first sheet is
chosen.

Alternatively, you could control the drop-down entirely programatically and
only add those items that you want to display at any given moment. (In
other words, replace the For Each sh loop with something a little more
"choosy".)


Rob

ibo4lyf wrote:
Big thanks to groups user huntermcg for this find.

I have entered this into my "ThisWorkbook" -

Private Sub Workbook_Open()
Dim sh As Object

On Error Resume Next
Application.CommandBars("Navigate XL-Dennis").Delete
Application.CommandBars("Navigate Sheets").Delete
On Error GoTo 0

With Application.CommandBars.Add("Navigate Sheets", , False, True)

With .Controls.Add(msoControlButton)
..TooltipText = "Move Back"
..FaceId = 1017
..OnAction = "Move_Back"
..BeginGroup = True
End With

With .Controls.Add(msoControlDropdown)
For Each sh In ThisWorkbook.Sheets
..AddItem sh.Name
Next sh
..TooltipText = "SheetNavigate"
..OnAction = "Sheet_Navigate"
End With

With .Controls.Add(msoControlButton)
..TooltipText = "Move next"
..FaceId = 1018
..OnAction = "Move_Next"
End With

..Protection = msoBarNoCustomize
..Position = msoBarFloating
..Visible = True
End With
End Sub


and then I entered this into a module -


Private Sub Sheet_Navigate()
Dim stActiveSheet As String

With CommandBars.ActionControl
stActiveSheet = .List(.ListIndex)
ThisWorkbook.Sheets(stActiveSheet).Activate
End With
End Sub

Private Sub Move_Back()
On Error Resume Next
ActiveSheet.Previous.Select
End Sub

Private Sub Move_Next()
On Error Resume Next
ActiveSheet.Next.Select
End Sub


This created a neat little drop down menu for sheet navigation.
(thanks to Bob Phillips for the code at
http://www.excelforum.com/newreply.p...te=1&p=1358771)


QUESTION -

I've applied this to a project of mine and it works great.

Although with my project I have a workbook with over 250 sheets :-)

Is their a way to limit the amount of sheets displayed in the drop
down box?

also if the above is possible...

Is their a way to have different set of sheets displayed for each
worksheet?

For example, on "sheet 1", the drop down only displays sheets 2-5.
Upon the users arrival to sheet 4, the drop down menu displays sheets
30-50.

Thanks for the help in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel,microsoft.public.access.modulesdaovba
external usenet poster
 
Posts: 6
Default Drop Down Menu Options? Need a PRO

I hope it's not too much to ask for an example.

I am looking for limited options in the menu.

When the user is on the home page, I would like the drop down to give
only five options (worksheets). When the user chooses one and arrives
at that worksheet, the drop down will give another set of worksheets
to choose from.

Thanks again! Google groups is the best!
  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel,microsoft.public.access.modulesdaovba
external usenet poster
 
Posts: 2
Default Drop Down Menu Options? Need a PRO

I'm honestly not sure how you'd do that when changing sheets in Excel. I
haven't done much work with command bars, and only in Access so far.


Rob

ibo4lyf wrote:
I hope it's not too much to ask for an example.

I am looking for limited options in the menu.

When the user is on the home page, I would like the drop down to give
only five options (worksheets). When the user chooses one and arrives
at that worksheet, the drop down will give another set of worksheets
to choose from.

Thanks again! Google groups is the best!

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
Limit Drop Down Menu Options Among Cells BP Excel Discussion (Misc queries) 1 June 23rd 08 12:43 AM
Displaying Drop-Down Menu Options AndyD4 Excel Discussion (Misc queries) 2 August 2nd 07 04:25 PM
how do i choose multiple options in a drop down menu in excel? DukeDevil Excel Discussion (Misc queries) 1 July 6th 06 10:20 PM
Drop-down menu options conksu Excel Discussion (Misc queries) 3 April 27th 06 06:50 PM
How do I increase the font of my drop-down menu options? heliu8 Excel Worksheet Functions 2 December 14th 05 06:00 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"