rollingzep
Board Regular
- Joined
- Nov 18, 2013
- Messages
- 214
- Office Version
- 365
- Platform
- Windows
Hi,
I have worksheet with 240 columns which have several columns whose headers are yellow colored and has to be deleted.
Sub delCols()
Dim lCol As Long
Dim iColCnt As Long
lCol = 240
For iColCnt = lCol To 1 Step -1
If Cells(1, iColCnt).Interior.ColorIndex = vbyellow
Columns(iColCnt).Delete
End If
Next
End Sub
This put my code in endless loop and did not work.
Any ideas?
I have worksheet with 240 columns which have several columns whose headers are yellow colored and has to be deleted.
Sub delCols()
Dim lCol As Long
Dim iColCnt As Long
lCol = 240
For iColCnt = lCol To 1 Step -1
If Cells(1, iColCnt).Interior.ColorIndex = vbyellow
Columns(iColCnt).Delete
End If
Next
End Sub
This put my code in endless loop and did not work.
Any ideas?