Hi,
I have a front page sheet where you select a few options, which then puts "hide" or "keep" above the columns that may or may not require hiding on sheets 2 through 5. The current code i have works when you deactivate the front page sheet, and calls the macro to hide columns that have "hide" and not hide columns that have "keep". Unfortunately this code only works for the next sheet selected, and not the remaining sheets. Any help to have this run smoothly would be greatly appreciated. Total newbie over here! Thanks.
This is my frontpage worksheet deactivate code below:
Sub Worksheet_Deactivate()
Call P4CSRHide
End Sub
The module macro that the above is calling is below:
Sub P4CSRHide()
Dim c As Range
For Each c In Range("D1:Q1").Cells
If c.Value = "Hide" Then
c.EntireColumn.Hidden = True
End If
If c.Value = "Keep" Then
c.EntireColumn.Hidden = False
End If
Next c
End Sub
I have a front page sheet where you select a few options, which then puts "hide" or "keep" above the columns that may or may not require hiding on sheets 2 through 5. The current code i have works when you deactivate the front page sheet, and calls the macro to hide columns that have "hide" and not hide columns that have "keep". Unfortunately this code only works for the next sheet selected, and not the remaining sheets. Any help to have this run smoothly would be greatly appreciated. Total newbie over here! Thanks.
This is my frontpage worksheet deactivate code below:
Sub Worksheet_Deactivate()
Call P4CSRHide
End Sub
The module macro that the above is calling is below:
Sub P4CSRHide()
Dim c As Range
For Each c In Range("D1:Q1").Cells
If c.Value = "Hide" Then
c.EntireColumn.Hidden = True
End If
If c.Value = "Keep" Then
c.EntireColumn.Hidden = False
End If
Next c
End Sub