_ Author Debra Dalgleish Posted on OctoDecemCategories Excel VBA
#HOW TO UNHIDE ALL SHEETS IN EXCEL 2010 CODE#
The finished code will look like the procedure shown in the screen shot below.īack in Excel, select a country name from the drop down list, and the ExportForm sheet should show or hide automatically. If Target.Address = Me.Range("CountrySel").Address Then Private Sub Worksheet_Change(ByVal Target As Range) The code will check the address of the cell that was changed, and show the ExportForm sheet if Canada is selected.
Turn off the macro recorder, and press Alt+F11, to open the Excel Visual Basic Editor. In the Unhide dialog box, click on the ExportForm sheet name, and click OK. To see the sheet again, click on the Orders sheet tab, and click Unhide. Then, right click on the ExportForm sheet tab, and click Hide. To see what the code should look like, you can turn on the Excel macro recorder, store the macro in a new workbook, and click OK. We’ll be adding some Excel VBA code to hide and unhide the ExportForm sheet. On the Orders sheet, the Country drop down list is created with Excel data validation. If Canada is selected, we need to print the ExportForm sheet, as well as the Orders sheet. This workbook has an order sheet, and there is a country selector at the top of the sheet. In this example we’ll hide Excel sheet when cell changes. Instead of manually hiding or showing the sheets, you can use Excel VBA to automatically hide or show them. In an Excel workbook, you might have some sheets that you don’t need to see all the time.