Hi, everybody 
I use this macro to delete rows with a lower amount compared to the one specified by the user:
Sub DeleteRows()
Dim ur As Integer
Dim limit$
limit = InputBox("Delete rows with amount lower than:", "INSERT THE AMOUNT")
With Sheets("mySheet")
ur = .Cells(Rows.Count, 22).End(xlUp).Row
For n = ur To 2 Step -1
If .Cells(n, 22).Value < CLng(limit) Then
.Cells(n, 22).EntireRow.Delete
End If
Next n
End With
MsgBox ("Operation completed successfully")
End Sub
Now I need something more. Let's assume that those amounts are related to some client: I have to delete ALL the rows related to a client, if none of them reach the amount specified by the user.
For example:
Client A - 25
Client A - 29
Client A - 35
Client B - 28
Client B - 26
Client B - 29
If the limit is 30, I must keep all of rows for Client A, and delete all of rows for Client B.
I hope my explanation was quite clear...
Any help is welcome,
thank you in advance!
Bookmarks