Activating Hidden Worksheets From Combo Box Selections

davidhall

Board Regular
Joined
Mar 6, 2011
Messages
174
I have a combo box that has several names in it for the user to select. Based on what they select, for instance, the name Jennifer, then a hidden worksheet should appear. The title of the worksheet that should appear is the employees name. Any suggestions?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Assuming your combo box is named ComboBox1 (change to suit) and is an Active-X control:
Code:
Private Sub ComboBox1_Change()
Dim shtNam As String
shtNam = ComboBox1.Text
ThisWorkbook.Sheets(shtNam).Visible = True
End Sub
 
Upvote 0
Thanks. Couple quick questions. Will that still work if its not an active x control? Also, if the selected name from the combo box is the name and the sheet name is Sheet1 for person A and Sheet2 for person B, how can I make that work so that I don't have to change the multiple worksheets to correspond to the persons name? I can setup two columns side by side with row A listing the persons name and row B stating the corresponding worksheet.
 
Upvote 0
If you use a forms control rather than an Active-X control, then you can't use the change event to trigger making the sheet visible. If you don't want to name the sheets after the employees you can create a look-up table as you suggested and use something like this in the code:
Code:
Dim lkuprng as range
set lkuprng = Range("your look-up range between these quotes")
' previous code
shtNam =worksheetfunction.VLookup(ComboBox1.Text,lkuprng,2,0)
'previous code
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top