VBA to Hide Unhide sheets based on dropdown selection.

sanket_sk

Board Regular
Joined
Dec 27, 2016
Messages
140
Office Version
  1. 365
Platform
  1. Windows
Hi There,

I have 4+ hidden sheets in workbook ( Jan~Mar Just created for sample) +1 Menu Sheet.

Menu sheet has dropdown of Month Jan~Mar.

I want user to select any month and that particular sheet need to be unhide, keep rest of the sheet hidden as well as hide menu sheet as well, in case user selects Back to Menu in any of the sheet VBA should unhide only Menu sheet and rest of the sheets go to hidden.

Menu Sheet
Dropdown is in Cell A2

Rest of the Month Sheets
Back to Menu is in Cell D2

Could you please help me build suitable VBA.

Thanks & Regards,

Sanket
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
maybe something along the lines of
VBA Code:
Private Sub ComboBox2_Change()
Dim ws As Worksheet

Set ws = Worksheets(ComboBox2)
ws.Visible = xlSheetVisible
For Each ws In ThisWorkbook.Sheets
     If ws.Name <> Worksheets(ComboBox2).Name Then ws.Visible = False
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

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