marchantvii
New Member
- Joined
- Jun 2, 2016
- Messages
- 3
- Office Version
- 2010
- Platform
- Windows
Hi all,
I have the following code below that was running fine until I came to use it this month.
I use this to search through col A on an imported spreadsheet for anything like "DATE" and delete that row and the next 7 rows below. This block repeats roughly every 24/25 rows.
I am currently getting the following error message when running:
The data is roughly 1500 rows long.
Any help would be greatly appreciated.
I have the following code below that was running fine until I came to use it this month.
I use this to search through col A on an imported spreadsheet for anything like "DATE" and delete that row and the next 7 rows below. This block repeats roughly every 24/25 rows.
I am currently getting the following error message when running:
VBA Code:
Sub GRNI_002_DeleteHeaderRows()
Range("A1").Select
Dim lastRow As Long
Dim CurrentRow As Long
lastRow = Range("A1").End(xlDown).Row
CurrentRow = 1
Do While CurrentRow <= lastRow
If Range("A" & CurrentRow).Value Like "*DATE*" Then
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
Range("A" & CurrentRow).EntireRow.Delete
lastRow = lastRow - 8
CurrentRow = CurrentRow - 8
End If
' put the pointer to the next row we want to evaluate
CurrentRow = CurrentRow + 1
Loop
End Sub
The data is roughly 1500 rows long.
Any help would be greatly appreciated.