sheet select

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

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