Berenloper
Board Regular
- Joined
- May 28, 2009
- Messages
- 83
- Office Version
- 365
- Platform
- Windows
Hi everyone,
I'm trying to hide empty columns on the active row (and preferably on multiple rows), but can't find the right code for it.
I have this:
So, when I'm on row 3 e.g. I wan't the code to run on that row.
It would be even better if selecting more than 1 row also hides all empty columns within that selection!
Thanks for helping me out on this.
Regards,
Berenloper
I'm trying to hide empty columns on the active row (and preferably on multiple rows), but can't find the right code for it.
I have this:
VBA Code:
Sub Hide_Columns_No_Value()
Dim c As Range
For Each c In Range("A1:GU1").Cells
If c.Value = Not IsEmpty(ActiveCell.Value) Then
c.EntireColumn.Hidden = True
End If
Next c
End Sub
So, when I'm on row 3 e.g. I wan't the code to run on that row.
It would be even better if selecting more than 1 row also hides all empty columns within that selection!
Thanks for helping me out on this.
Regards,
Berenloper