Hey guys, I am again stumped on the syntax for this code. If someone could take a look at it for me I would appreciate it very much.
I am trying to step through a dynamic range in both columns and rows and delete any columns that have value of "0". In row 1 is the headers for each column.
I think the problem is with the variable "col"???
Sub n()
Dim ws As Worksheet
Dim LR As Long, i As Long, LC As Long
Dim col As Range
Set ws = ActiveSheet
LC = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
LR = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row
For i = LC To 2 Step -1
Set col = ws.Range(Cells(2, i), Cells(LR, i))
If col Is Nothing Then
ws.Columns(i).EntireColumn.Delete Shift:=xlShiftLeft
End If
Set col = Nothing
Next i
End Sub
Thanks
Bookmarks