Hi everyone, another afternoon trying to work a little sub routine. I have 12,000 rows with values from 1 to 11. I would like to sort column A and delete all rows <> "5" (the vlue of 5). Below is a sub I copied out of Mr. Excel but I was unable to get it to work. The sort was not included as seen below. Where am I going awry?
____________________________________________________________________________
Sub test()
'start at row 1
Dim i As Long
i = 1
'while cell C contains something
While Cells(i, 1) <> ""
'select the row
Rows(i).Select 'this is optional
' if D >= C
'If Cells(i, 4) >= Cells(i, 3) Then
'delete the row
Rows(i).Delete
Else 'or
'go to the next row
i = i + 1
End If
Wend
End Sub
____________________________________________________________________________
Sub test()
'start at row 1
Dim i As Long
i = 1
'while cell C contains something
While Cells(i, 1) <> ""
'select the row
Rows(i).Select 'this is optional
' if D >= C
'If Cells(i, 4) >= Cells(i, 3) Then
'delete the row
Rows(i).Delete
Else 'or
'go to the next row
i = i + 1
End If
Wend
End Sub