Please help
I am writing a macro code that will automatically remove colummns on a spreadsheet. The criteria is in row 1 (header) and is a number.
The code I have tried to write is as follows
but it doesnt seem to be working. What this particular code needs to do is delete any colummn whose header is higher than the value 1005
Any help from you gurus would be appreciated
Thanks in advance
I am writing a macro code that will automatically remove colummns on a spreadsheet. The criteria is in row 1 (header) and is a number.
The code I have tried to write is as follows
Code:
Sheets("WX_CAPPLAN").Select
Dim LastCol As Integer, c As Integer
LastCol = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column
For c = LastCol To 2 Step -1
If Cells(1, c).Value > "1005" Then Columns(c).Delete
Next c
but it doesnt seem to be working. What this particular code needs to do is delete any colummn whose header is higher than the value 1005
Any help from you gurus would be appreciated
Thanks in advance