I put a combobox on a worksheet and used this code behind that worksheet:
Option Explicit
Dim BlkProc As Boolean
'I used _change, not _click
Private Sub ComboBox1_Change()
If BlkProc = True Then Exit Sub
With Me.ComboBox1
If .ListIndex <> -1 Then
Worksheets(.Value).Select
BlkProc = True
.ListIndex = 0
BlkProc = False
End If
End With
End Sub
Private Sub Worksheet_Activate()
Dim wks As Worksheet
With Me.ComboBox1
BlkProc = True
.Clear
.AddItem ">Select<"
For Each wks In ThisWorkbook.Worksheets
If wks.Name = Me.Name Then
'skip it
Else
.AddItem wks.Name
End If
Next wks
.ListIndex = 0
BlkProc = False
End With
End Sub
An alternative from Debra Dalgleish's site:
http://contextures.com/xlToolbar01.html
Anniem wrote:
>
> Hi and thanks in anticipation for helping with this problem....
>
> I have a workbook comprising of 16 worksheets each of which has a Combo Box
> (from Control Toolbox) which provides links to the other sheets. The code
> for the Combo Box(es) is:
>
> Private Sub ComboBox1_Click()
> If ComboBox1.ListIndex <> -1 Then
> Worksheets(ComboBox1.Value).Select
> End If
>
> End Sub
>
> but what do I need to add to make the Combo Box default to ">Select<" (top
> line) after the user has clicked on the name of the sheet they want to go to
> next.
>
> Apologies if this has already been asked and answered, but I can't find
> anything that does the trick.
--
Dave Peterson