Hello everyone, I hope you can be of assistance
I am trying to automate a worksheet using VBA to hide unecessary columns when they have no data input, but then unhide them when data is input...
On one worksheet, from row E5 to BA5 will either display a 0 or any text entry linked from another worksheet, I basically want:
Sub HideColumn()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For a = 0 To 3
If Range("E5").Offset(0, a).Value = "Hide Column" Then Range("E5").Offset(0, a).EntireColumn.Hidden = True
Next a
Application.ScreenUpdating = True
End Sub
Thanks in advance
David
I am trying to automate a worksheet using VBA to hide unecessary columns when they have no data input, but then unhide them when data is input...
On one worksheet, from row E5 to BA5 will either display a 0 or any text entry linked from another worksheet, I basically want:
- for individual columns to hide where the 5th row (range E5 to BA5) displays 0
- for individual columns to unhide when any text entry is displayed in the same 5th row (range E5 to BA5)
Sub HideColumn()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For a = 0 To 3
If Range("E5").Offset(0, a).Value = "Hide Column" Then Range("E5").Offset(0, a).EntireColumn.Hidden = True
Next a
Application.ScreenUpdating = True
End Sub
Thanks in advance
David
Last edited: