Hi,
I am trying to delete all columns that have a 99 in the first row. I have written the code below and it won't work. I am only new to the VBA game so any help would be appreciated.
Sub deletecolumn()
For Each c In Range("a1:bf1")
If c = 99 Then
Columns(c.Column).EntireColumn.Delete = True
Else
Columns(c.Column).EntireColumn.Delete = False
End If
Next
End Sub
I am trying to delete all columns that have a 99 in the first row. I have written the code below and it won't work. I am only new to the VBA game so any help would be appreciated.
Sub deletecolumn()
For Each c In Range("a1:bf1")
If c = 99 Then
Columns(c.Column).EntireColumn.Delete = True
Else
Columns(c.Column).EntireColumn.Delete = False
End If
Next
End Sub