VBA – Hide specific range per each sheet + formula for tab
In this article I will simply combine two different subjects – creation of formula, displaying the name of the tab and hiding a specific range per each Excel sheet.
- Concerning the formula, here it is:
=REPLACE(CELL(“filename”,A1),1,FIND(“]”,CELL(“filename”,A1)),””)
- Concerning the VBA code:
Sub hide()
Dim sheet
For Each sheet In ThisWorkbook.Sheets
Range("AD:AZ").EntireColumn.Hidden = True
Next
End Sub
This VBA example code is one of the simplest & most used excel VBA codes, for a loop of sheets. In stead of hiding the column, it may do many other usefull things.
Enjoy it!