Hi Guys, I am trying to delete all the rows preceeding the row that has 'o1cr' in the first 4 bytes of col 'A'. However it seems to be deleting every other row (all even number rows). The first row is a hdr row and as you can see I skip that one by ck'ing for the literal "AccountNumber".
Any ideas what the heck I'm doing wrong??
Thanx much
Trudye
Any ideas what the heck I'm doing wrong??
Thanx much
Trudye
Code:
Function CleanUp_File()
Dim i As Integer
Dim MaxElements As Integer
Dim cnt As Integer
Dim LeftValue As String
LeftValue = ""
cnt = 0
MaxElements = 7000
ActiveCell.Range("A2").Select
For i = 1 To MaxElements
LeftValue = Left(Cells(i, 1), 11)
If Left(Cells(i, 1), 4) = "01CR" Then
Exit For
ElseIf Cells(i, 1) = "AccountNumber" Then
Else
Rows(i).Delete
End If
Next i
End Function