Tuesday 10 September 2013

Delete fields less than a specific value VBA

Delete fields less than a specific value VBA

I have the following column in excel
Sales Record Number 5100 5275 5310 5355 5357 5359 15 Seller ID: 233
I need VBA code to only show the rows greater than the value of 5000 so
'sales record number, '15' & "Seller ID" should be deleted.
I have tried the following:
Sub DeleteRows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim i As Long
For i = Range("A" & Rows.Count).End(xlUp).Row To 1 Step -1
If Not (Range("C" & i).Value < 5000) Then
Range("C" & i).EntireRow.Delete
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

No comments:

Post a Comment