Delete a row at a time based on user input

utlavadude

New Member
Joined
Dec 17, 2013
Messages
2
I hope someone can help me.

I have a spreadsheet that has records that I need to delete based on a scanned value. Long story short, I want to be able to scan a barcode for an MO# (see below), search for the MO in colomn B, have it delete the row that has the MO#, then go back to the prompt ready for the next scan.

Note: The barcode does not have any of the " - RE" at the end of it.

Any and all help is GREATLY appreciated!


Sample Data:
(MO)MOSOProductQtyShip DateDescription
(MO-345559)MO-345559 - ReSO-266348 ZLBPBT-MINT, MINT SPF LIP BALM BLACK TUBE 5002013-12-20(ZLBPBT-MINT)
(MO-345209)MO-345209 - ReSO-266041 ZLBPWT-BERRY, BERRY SPF LIP BALM WHITE TUBE 5602013-12-20(ZLBPWT-BERRY)
(MO-345561)MO-345561 - ReSO-266368 ZLBPWT-UNFL, UNFLAVORED SPF LIP BALM WHITE TUBE 150002013-12-20(ZLBPWT-UNFL)
(MO-345562)MO-345562 - ReSO-266368 ZLBPWT-UNFL, UNFLAVORED SPF LIP BALM WHITE TUBE 150002013-12-20(ZLBPWT-UNFL)

<colgroup><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I figured it out on my own. Thanks anyway :)

Here's what I came up with:

Sub ClearPrinted()
'
' ClearPrinted Macro
'


Start:


Dim MO As String


MO = InputBox("Enter MO to Search for.")


'cancel button clicked, or nothing entered when OK was clicked
If MO = "" Then Exit Sub


lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For x = lastrow To 1 Step -1
If Cells(x, 2) = MO & " - Re" Then
Rows(x).Delete

' Else
' MsgBox "You must enter an MO Number", vbOKOnly + vbExclamation, "Invalid Entry"

End If
Next x

GoSub Start:








End Sub
 
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,772
Members
449,336
Latest member
p17tootie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top