Selecting a worksheet with a ComboBox

T

Todd

I have a ComboBox that is populated by all of the
worksheets contained in a workbook. I would like to select
a worksheet by using the ComboBox. I haven't been able to
get anything to work. I would imagine you would assign the
combobox value to a variable and select the worksheet
using the variable name or is there a better way?

Thanks,

Todd
 
B

Bob Phillips

Why not just use

Worksheets(Combobox1.Value).Activate

in the code linked to the combobox click event?
 
W

whisperer

You should make a list of all of the worksheet names and then define th
list as a named list (Insert Name Define).

Now in the Rowsource property of the combobox insert

sheet!name

where sheet is the worksheet containing your named list and name is th
defined name of the list.

When you run the combobox now then you will have the worksheets t
select from.

Finally place the following code
Code
-------------------


Private Sub ComboBox1_Change()
Worksheets(ComboBox1.Text).Activate
End Sub
-------------------


changing combobox1 to match the name of your combobox.

HTH

Gordo
 
Top