![unhide a column in excel vba unhide a column in excel vba](https://2.bp.blogspot.com/-zeBhMq6_mKM/V1rjCRO140I/AAAAAAAAGHM/9WTu3Lnb41EafRVa524r6d3kSmdhccoCQCLcB/w1200-h630-p-k-nu/dependent_comboboxes.jpg)
To put our code to the test all we need to do is create and show the ManageWorksheets VBA UserForm.If the first row (row 1) or column (column A) is not displayed in the worksheet, it is a little tricky to unhide it because there is no easy way to select that row or column. If lSheets.Selected(i) = False Then ActiveWorkbook.Sheets(lSheets.List(i)).Visible = xlSheetHidden If lSheets.Selected(i) = True Then ActiveWorkbook.Sheets(lSheets.List(i)).Visible = xlSheetVisible 'First make visible selected Worksheets as otherwise code might crash LSheets.Selected(it) = IIf(ActiveWorkbook.Sheets(ws.Name).Visible = xlSheetVisible, True, False) LSheets.MultiSelect = fmMultiSelectExtended 'Make sure more than 1 can Sheet can be selected Lists all worksheets and selects visible ones If you named your objects correctly past the following code into the VBA UserForm source code:
![unhide a column in excel vba unhide a column in excel vba](https://cdn.extendoffice.com/images/stories/doc-excel/doc-button-to-show-hide-columns/doc-button-show-hide-buttons12.png)
Create the UserFormįirst you need to create a VBA UserForm with a VBA ListBox and a VBA CommandButton:
UNHIDE A COLUMN IN EXCEL VBA HOW TO
Lastly to learn how to Unhide Sheets in Excel we will sum up what we have learned and make a simple VBA UserForm to be able to quick manage visibily across the entire list of Excel Worksheets. When a certain Worksheet name matches our VBA Like function statement we make it visible. What is happening is using the VBA For Each loop we are iterating through the VBA Collection of Worksheets. The code above will unhide all Worksheets which name starts with Hidden and suffixed by any number of characters e.g. Similarly as above we can wrap it up to a oneliner to run in the Immediate Window: For Each ws In Sheets: ws.Visible=Iif(ws.Visible = xlSheetVisible or ws.Name Like "Hidden*",ws.Visible,xlSheetHidden):Next ws 'If the name of the Worksheet starts with "Hidden" then. For this we can amend the code above using the VBA Like operator: Instead you might want to Unhide only a subset of the Hidden Worksheets using a name pattern.Īssume you want to Unhide all Worksheets that fall into a certain pattern where part of the name can be any sequence of characters. In many cases you don’t necessarily want to Unhide all Sheets in Excel. 'Sets the visibility of the Worksheet to true 'Will loop through all worsheets in the ActiveWorkbook Next in the Immediate Window let us type: For Each ws In Sheets:ws.Visible=xlSheetVisible:Next wsīelow the same code as above but spread across multiple lines.
![unhide a column in excel vba unhide a column in excel vba](https://www.knowledgewave.com/hs-fs/hubfs/hideexcelrows2.png)
Again let us open the Visual Basic Editor by using the Excel Keyboard shortcut ALT+ F11. To unhide all Sheets in Excel we must revert to VBA as there is no other way to select multiple worksheets using the built in Excel Unhide window. This will hide the worksheet named NameOfWorksheet. Sheets("NameOfWorksheet").Visible = xlSheetHidden Instead of using xlSheetVisible just use xlSheetHidden: If you want to Hide a Worksheet in Excel using VBA you can modify the code above. Where NameOfWorksheet is obviously the name of the Worksheet you want to Unhide in Excel. Sheets("NameOfWorksheet").Visible = xlSheetVisible You can type the below in the Immediate window and hit Enter: To do this quickly simply us this Excel Keyboard shortcut ALT+ F11. To Unhide a single Worksheet in Excel using VBA we need to use open the Visual Basic Editor. Select the Worksheet you want to unhide and click Ok.Click the Unhide button in the opened tab.To unhide a Hidden Worksheet in Excel proceed as follows: Then I will show you a few tricks of how to unhide all Sheets in Excel using VBA. I will start by showing a way to manually unhide an Excel Worksheet using the Excel Unhide Window. To unhide Sheets in Excel you need to right click on the Worksheet tab and select the Worksheet you want to unhide from the Unhide Window.