Excel VBA - Delete Rows with certain text...

J

JMax

I am quite stuck to say the least. I have this file about 13K rows tha
was exported from Fox Pro. In order to manipulate it, I need to delet
every (entire) row that contains the text 'Store Totals for:' At firs
I thought I needed to delete every 5th row but that was not what
needed nor did it work.....The text is in column A. Any help would b
appreciated.


Sub DeleteRows()
Dim cell As Range
Dim ICol As Integer
Dim IRow As Integer
Dim myRange As Range

ICol = Range("A1").End(xlToRight).Column
IRow = Range("A1").End(xlDown).Row
Set myRange = Range(Cells(1, 1), Cells(IRow, ICol))

For x = IRow To 2 Step -1
Set cell = Range("A" & x)
cell.Select
If cell.Value = cell.Offset(5, 0).Value Then
cell.EntireRow.Delete
End If
Next x
End Su
 
J

JMax

Hello Ron de Bruin,

Thank you for the link as well as the prompt response!

Take care,
JMax
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top