There must be something really simple I'm missing here, but I just can't figure it out. I have a process that loops through every worksheet in my active workbook and adds a filter. Then for specific sheets I want specific columns hidden. The first part of the process works great, however the second part ends up hiding EVERY column instead of just the ones I specify. Here is the snippet of code:
Sub FilterProcess()
Dim District As String, ws As Worksheet, header As Range, lc As Long, varRow As Integer
For Each ws In ActiveWorkbook.Worksheets
''''''''''''''''''''''''''''''''''''''''
' (code that adds a filter and defines the header row for each worksheet is here) '
''''''''''''''''''''''''''''''''''''''''
If ws.Name = "Buyback" Then
For Each i In header
If i.Value = "Store Name" Or _
"Region" Or _
"Location Type" Or _
"Receipt Date"
Then
Columns(i.Column).EntireColumn.Hidden = True
End If
Next i
End If
Next ws
End Sub
This ends up hiding ALL columns instead of just the ones specified. If I remove the multiple OR arguments then it properly hides just the one column. Please let me know what I'm missing here!
Thanks!
Bookmarks