G
glimmer23
I am sure this si very simple but its one of those days.
I am trying to automatically hide columns based on a value/switch I
have the following VB:
Public Sub MyHide()
Application.ScreenUpdating = False
Dim cell As Range
For Each cell In Range("3:3")
If cell.Value = "1" Then
cell.EntireColumn.Hidden = True
End If
Next cell
Application.ScreenUpdating = True
End Sub
Which works - however its very slow as it check every single cell on
row 3 also if I run the macro again with hidden rows no longer
equaling 1 I need it to unhide them.
So basically I am trying to upgrade the above VBA to - Hide all
columns after the first "1" is found in row 3 and if it is hidden and
not a "1" to be unhidden - and if it helps if its not to be hidden it
will be a "0" and it will be everything left of the first 1.
so basically a macro that finds the first 1 on row 3 and hides
everything to the right and unhides everything to the left is exactly
what I need - if you can help me ill be most grateful.
I am trying to automatically hide columns based on a value/switch I
have the following VB:
Public Sub MyHide()
Application.ScreenUpdating = False
Dim cell As Range
For Each cell In Range("3:3")
If cell.Value = "1" Then
cell.EntireColumn.Hidden = True
End If
Next cell
Application.ScreenUpdating = True
End Sub
Which works - however its very slow as it check every single cell on
row 3 also if I run the macro again with hidden rows no longer
equaling 1 I need it to unhide them.
So basically I am trying to upgrade the above VBA to - Hide all
columns after the first "1" is found in row 3 and if it is hidden and
not a "1" to be unhidden - and if it helps if its not to be hidden it
will be a "0" and it will be everything left of the first 1.
so basically a macro that finds the first 1 on row 3 and hides
everything to the right and unhides everything to the left is exactly
what I need - if you can help me ill be most grateful.