Hiding and Unhiding worksheets in a Workbook

shyamvinjamuri

Board Regular
Joined
Aug 2, 2006
Messages
174
When I open the workbook, I would like only Sheet2 to be shown. Sheet2 has a code with message box.

Upon clicking OK in message box, I would like Sheet2 to be hidden and Sheet1 to be made visible.

PLease help

Thanks
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

larrydunn

Board Regular
Joined
Jun 1, 2003
Messages
130
Create Workbook Open procedure:

Private Sub Workbook_Open()
ActiveWorkbook.Sheets("Sheet2").Visible = True
ActiveWorkbook.Sheets("Sheet1").Visible = False
End Sub

Insert these lines into message box code:

ActiveWorkbook.Sheets("Sheet1").Visible = True
ActiveWorkbook.Sheets("Sheet2").Visible = False
 

Watch MrExcel Video

Forum statistics

Threads
1,108,708
Messages
5,524,431
Members
409,577
Latest member
Dwg

This Week's Hot Topics

Top