abenitez77
Board Regular
- Joined
- Dec 30, 2004
- Messages
- 149
What is a faster way of deleting columns that are empty? I am looping thru the first 200 columns to see if each column has data in a specific row. If it is blank, then I want to delete that column. My way takes about 20-30 seconds to run.
lastCol = 0
For i = 1 To 200
If ActiveCell.Value = "" Then
ActiveCell.EntireColumn.Delete
Else
ActiveCell.Offset(0, 1).Select
lastCol = lastCol + 1
End If
Next i
lastCol = 0
For i = 1 To 200
If ActiveCell.Value = "" Then
ActiveCell.EntireColumn.Delete
Else
ActiveCell.Offset(0, 1).Select
lastCol = lastCol + 1
End If
Next i