Edited Data Imported into Excel

E

ExcelMonkey

I have a sheet which imports data. The data that gets imported is no
spaced evenly. I want to be able to delete all the rows prior to th
row that the word "Price" occurs in. That is, if A13 says "Price",
would like to delete rows 1 to 12. "Price" only occurs in the Colum
A.

The problem I am having is that "price" is not occuring every 13 rows.
It varies in the data. I was originally deleting the first 12 row
within a loop but realized the uneven spacing of data was causing m
problems.

Thank-you
 
D

Dick Kusleika

EM

Try this

Sub DelRows()

Dim cell As Range
Dim FirstPrice As Boolean

FirstPrice = False

For Each cell In Range("A1:A50")
If cell.Value = "Price" Then
If FirstPrice Then
Range("a1", cell.Offset(-1, 0)).EntireRow.Delete
Exit For
Else
FirstPrice = True
End If
End If
Next cell

End Sub
 
Top