Selecting a worksheet with a ComboBox
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 |
Selecting a worksheet with a ComboBox
Why not just use
Worksheets(Combobox1.Value).Activate in the code linked to the combobox click event? -- HTH ------- Bob Phillips "Todd" wrote in message ... 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 |
Selecting a worksheet with a ComboBox
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 -- Message posted from http://www.ExcelForum.com |
Selecting a worksheet with a ComboBox
That's what it was...I had it linked to a Change event.
Thanks a lot Bob -----Original Message----- Why not just use Worksheets(Combobox1.Value).Activate in the code linked to the combobox click event? -- HTH ------- Bob Phillips "Todd" wrote in message ... 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 . |
All times are GMT +1. The time now is 12:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com