Where is this code, ou are only showing a snippet. The code below is using
the Form1_Initialize() event to load the items in the combobox and a button
on the form, hides it and selects the sheet from the combobox value.
Private Sub UserForm_Initialize()
With UserForm1.ComboBox8
.AddItem "Chapter 1"
.AddItem "Chapter 2"
.AddItem "Chapter 3"
End With
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
Dim Chapter As String
Chapter = UserForm1.ComboBox8.Value
UserForm1.Hide
Sheets(Chapter).Select
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS
"tbaam" wrote in message
...
I have a form that has a combo box in it. The combo box allows the user to
select a chapter. The chapter happens to be worksheet in a workbook.
How do i pass from the combo box into the macro.
This is what I want:
With ComboBox8
.AddItem "Chapter 1"
.AddItem "Chapter 2"
.AddItem "Chapter 3"
End With
Chapter = ComboBox8.Value
Sheets(Chapter).Select
*** if I write Sheets("Chapter 1") it works great...but just putting it
Chapter fails