Excel loop to delete redudent rows
You can't increment a string by a value of 1. Seperate the Cell letter &
number. This seemed to work in my test on excel 2003.
Sub delete()
Sheets("output").Select
Count = 1
MaxCount = 10
While Count < MaxCount
cell = "a" & Count
Range(cell).Select
If Selection = "LYR" Then
Selection.EntireRow.delete
Else
End If
Count = Count + 1
Wend
End Sub
" wrote:
I have a macro setup to copy data based off of filtres from one work
sheet to another. Only problem being is when it copies the data over it
copies the title row over each time so i have multiple sets of titles.
This is the macro i have so far which is totaly incorrect but it shows
what i'm trying to do. Any help would be greatly appreciated. "LYR" is
text and is one of the titles.
Sub delete()
'' Section to remove redundent titles put in when copying data from
original sheet
Sheets("output").Select
Min = "a3"
Max = "a65500"
cell = Min
While cell Max
Range(cell).Select
If Selection = "LYR" Then
Selection.EntireRow.delete:=xlUp
Else
End If
cell = cell + 1
Wend
End Sub
Thanks
Andrew
|