Leave rows 1-4 untouched for the header. Then I want to use row 5 to mark the columns to keep i.e. if row 5 is empty, delete that column from row 5 down. I'm getting an "Expected...Array" message for some reason. Thanks in advance.
VBA Code:
Sub DeleteBlankColumns() 'delete columns if row 5 is blank
Dim myLastCol As Long '
Dim myLastRow As Long
Dim myCol As Long
myLastCol = Cells(5, Columns.Count).End(xlToLeft).Column
For myCol = myLastCol To 1 Step -1
myLastRow = Cells(Rows.Count, myCol).End(xlUp).Row
If myLastRow(Cells(5, myLastRow).Value, "") Then
Columns(myLastRow).Delete Shift:=xlToLeft
End If
Next myCol
End Sub