Hello, need help with a macro that hides columns in multiple worksheets based on whether the drop down menu in that column in one worksheet says "HIDE"
Here is what I have so far, my issue is how do I exclude certain worksheets? Including the worksheet that the macro is in? Or I can just include certain worksheets, whichever is easier.
Sub Hide_Columns_Containing_Value_All_Sheets()
Dim c As Range
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Not ws.Name = "Sheet9" Then
End If
For Each c In Range("D4:N4").Cells
If c.Value = "HIDE" Then
c.EntireColumn.Hidden = True
End If
Next c
Next ws
End Sub
Here is what I have so far, my issue is how do I exclude certain worksheets? Including the worksheet that the macro is in? Or I can just include certain worksheets, whichever is easier.
Sub Hide_Columns_Containing_Value_All_Sheets()
Dim c As Range
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Not ws.Name = "Sheet9" Then
End If
For Each c In Range("D4:N4").Cells
If c.Value = "HIDE" Then
c.EntireColumn.Hidden = True
End If
Next c
Next ws
End Sub