Hide Worksheet with Combo Box

Ned Ludd

Board Regular
Joined
May 13, 2004
Messages
56
Hi Everybody!

I hope someone can help.

I have a workbook with 8 worksheets. I have hidden 3 (sheets 6,7 and 8) as I do not want my users to see them.

Of the remaining 5 worksheets, the user will only use 4 of them at any one time. I also have a combo box with yes and no answers.

If yes is selected, the user will use sheets 1,3,4,5. If no is selected, the user will use sheets 1,2,4,5.

What I want to do is have sheet 2 hidden if yes is selected and have sheet 3 hidden if no is selected.

Is there a way to do this without VB? (Or if it can only be done with VB, can you PLEASE be kind enough to give me the entire script as I have no idea how to use VB.)

Thank you very much.


Ned.
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Ned

Try
Code:
Private Sub ComboBox1_Change()
If ComboBox1.Value = "yes" Then
  Sheets("sheet2").Visible = False
  Sheets("sheet3").Visible = True
Else
 Sheets("sheet2").Visible = True
  Sheets("sheet3").Visible = False
End If
End Sub

It assumes that the combobox is called combobox1, it is from the control toolbox toolbar, and the numbers you have given refer to the sheet names, rather than the index position.

HTH

Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,118,383
Messages
5,571,818
Members
412,420
Latest member
Quintankerus
Top