Selecting a worksheet with a ComboBox

  • Thread starter Thread starter Todd
  • Start date Start date
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
 
Why not just use

Worksheets(Combobox1.Value).Activate

in the code linked to the combobox click event?
 
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
 
That's what it was...I had it linked to a Change event.

Thanks a lot Bob
 

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