I want to create a macro that finds the last column with a header and deletes it only if the sum of that column is equals to zero. Here's what I've tried so far:
Dim LastCol As Long, Dim i As Long
With ThisWorkbook.Sheets("Sheet1")
For i = Range("A1").Column To LastCol Step -1
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
If Application.Sum(Cells(1, i).Resize(LR, 1)) = 0 Then
Columns(i).EntireColumn.Delete
End With
Next i
Thanks in advance for your attention and help