Finding a worksheet

  • Thread starter Thread starter Patrick C. Simonds
  • Start date Start date
P

Patrick C. Simonds

I have a workbook which ranges from 40 to 55 worksheets, I thought it would
be helpful if I were to create a UserForm which would list the name of all
available worksheets (by be as a series of OptionButtons). The user would
then select the sheet they wanted to view next from the list and that sheet
would become active. Has anyone seen or done anything like this?
 
It might be easier to use a listbox rather than option buttons.
Or train all your users to instead right-click on the sheet navigation
arrows at bottom-left....

Tim
 
It might be easier to use a listbox rather than option buttons.
Or train all your users to instead right-click on the sheet navigation
arrows at bottom-left....

Tim





- Show quoted text -

have a userform, a combobox and a button and try this
Private Sub CommandButton1_Click()
Dim i As Long
Dim j As Long
For i = 1 To Worksheets.Count
j = i
Me.ComboBox1.AddItem Worksheets(j).Name
j = j + 1
Next i
End Sub

Private Sub ComboBox1_Change()
Dim kon As String
kon = Me.ComboBox1.Value
Sheets(kon).Select
End Sub
 
i've done it, but with a lot less sheets:

design a form with the optionbuttons (1 thru 8 in my case) named
optionbutton1, optionbutton2.....)

then when the form loads i just use this to populate the form with the sheet
names:

For i = 1 To 8
Me.Controls("optionbutton" & i).Caption = Worksheets(i).Name
Me.Controls("optionbutton" & i) = False
Next

then the code for each optionbutton can be something like this:

Private Sub OptionButton1_Click()
Worksheets(1).Activate
End Sub
 
Forget training them, apparently I need training. I did not know that one.
Does that also work in Office2003?
 
there is an easier way. Place this code in Thisworkbook Excel Objects sheet:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
On Error Resume Next
If ActiveWorkbook.Sheets.Count <= 16 Then
application.CommandBars("Workbook Tabs").ShowPopup 500, 225
Else
application.CommandBars("Workbook Tabs").Controls("More
Sheets...").Execute
End If
On Error GoTo 0
Cancel = True
End Sub

Instruct your users to right click anywhere on worksheet a PopUp menu will
appear with list of all sheet names.

Hope useful
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top