ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Go To Button on a spreadsheet. (https://www.excelbanter.com/excel-worksheet-functions/238223-go-button-spreadsheet.html)

Bob[_16_]

Go To Button on a spreadsheet.
 
I have the following code that i cannot get to work. In escence i
just
want to click on the button and go to the worksheet named in the
combobox. If i take the combobox away and just type a name into a
cell
say A4 it works fine. Obviously i am not referencing the Combobox
properly.

Private Sub CommandButton1_Click()
Worksheets(Range("ComboBox1").Value).Activate


End Sub


With thanks


Bob

Mike H

Go To Button on a spreadsheet.
 
Try this

Private Sub ComboBox1_Change()
Sheets(ComboBox1.Text).Select
End Sub

Mike

"Bob" wrote:

I have the following code that i cannot get to work. In escence i
just
want to click on the button and go to the worksheet named in the
combobox. If i take the combobox away and just type a name into a
cell
say A4 it works fine. Obviously i am not referencing the Combobox
properly.

Private Sub CommandButton1_Click()
Worksheets(Range("ComboBox1").Value).Activate


End Sub


With thanks


Bob



All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com