ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sheet select (https://www.excelbanter.com/excel-programming/324958-sheet-select.html)

scrabtree23[_3_]

sheet select
 
I have sheet named "Tom", "Bill", and "Joe".

I have a useform with a combobox that has the options "Tom, Bill and Joe".
I want a code that will select the appropriate sheet depending on the cmbx
selection.

Jim Thomlinson[_3_]

sheet select
 
I assume that you have the combo box in a cell. Here is some code that will
do what you need.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
On Error Resume Next
Sheets(Target.Value).Select
End If
End Sub

It assumes that you combo box is in Cell A1. You can change that by changing:

Target.Address = "$A$1"

To add this code. Right Click on the worksheet tab that contains the combo
box. the last itme on the list is view code. Select View code and then just
paste this code in and you are off and running...

HTH


"scrabtree23" wrote:

I have sheet named "Tom", "Bill", and "Joe".

I have a useform with a combobox that has the options "Tom, Bill and Joe".
I want a code that will select the appropriate sheet depending on the cmbx
selection.



All times are GMT +1. The time now is 03:09 AM.

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