Hi Guys,
I'm looking for the correct way of deleting coulmns based on if row 2 has an x in it..
I have two versions that I tried but im pretty sure there are faster ways of doing it, I don't quite know how to delete all the columns at once.
' Version 1
FurthestRightColumn = Range("IV2").End(xlToLeft).Column
With Range("A2:A" & FurthestRightColumn)
.SpecialCells(xlCellTypeConstants).EntireColumn.Delete
End With
' Version 2
i = 1
For y = Range("IV2").End(xlToLeft).Column To i Step -1
If Cells(2, y).Value = "x" Then
Columns(y).Delete
End If
Next y
The first version doesn't work for some reason and the second column works but is a slow loop, any ideas what to do to make this faster?
Bookmarks