Hi, I have this macro (code below) that asks for input from a user to delete rows that have a certain value or less in the 'C' column. This works perfectly however how can I adjust this macro to to leave the cells that have no value (blank) alone. THis is a header column that I would like to leave and is currently being removed by the current code.
Thanks for the help.
bDunk
Sub Delete_Part_Input()
Dim Qty As Integer, i As Integer, ans As Variant
Qty = Application.InputBox("What total quantities would you like to delete? Note: This is the value located in the C column.", Type:=1)
If Qty = 0 Then Exit Sub
ans = MsgBox("All totals with a quantity of " & Qty & _
" or less will be deleted." & vbCrLf & vbCrLf & _
"Do you want to continue?", vbYesNo + vbExclamation)
If ans = vbNo Then Exit Sub
For i = Qty To 0 Step -1
Columns(3).Replace what:=i, replacement:="", LookAt:=xlWhole
Next i
Columns(3).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Thanks for the help.
bDunk
Sub Delete_Part_Input()
Dim Qty As Integer, i As Integer, ans As Variant
Qty = Application.InputBox("What total quantities would you like to delete? Note: This is the value located in the C column.", Type:=1)
If Qty = 0 Then Exit Sub
ans = MsgBox("All totals with a quantity of " & Qty & _
" or less will be deleted." & vbCrLf & vbCrLf & _
"Do you want to continue?", vbYesNo + vbExclamation)
If ans = vbNo Then Exit Sub
For i = Qty To 0 Step -1
Columns(3).Replace what:=i, replacement:="", LookAt:=xlWhole
Next i
Columns(3).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub