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:
[TABLE="width: 1063"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD](MO)[/TD]
[TD]MO[/TD]
[TD]SO[/TD]
[TD]Product[/TD]
[TD]Qty[/TD]
[TD]Ship Date[/TD]
[TD]Description[/TD]
[/TR]
[TR]
[TD](MO-345559)[/TD]
[TD]MO-345559 - Re[/TD]
[TD]SO-266348 [/TD]
[TD]ZLBPBT-MINT, MINT SPF LIP BALM BLACK TUBE [/TD]
[TD="align: right"]500[/TD]
[TD="align: right"]2013-12-20[/TD]
[TD](ZLBPBT-MINT)[/TD]
[/TR]
[TR]
[TD](MO-345209)[/TD]
[TD]MO-345209 - Re[/TD]
[TD]SO-266041 [/TD]
[TD]ZLBPWT-BERRY, BERRY SPF LIP BALM WHITE TUBE [/TD]
[TD="align: right"]560[/TD]
[TD="align: right"]2013-12-20[/TD]
[TD](ZLBPWT-BERRY)[/TD]
[/TR]
[TR]
[TD](MO-345561)[/TD]
[TD]MO-345561 - Re[/TD]
[TD]SO-266368 [/TD]
[TD]ZLBPWT-UNFL, UNFLAVORED SPF LIP BALM WHITE TUBE [/TD]
[TD="align: right"]15000[/TD]
[TD="align: right"]2013-12-20[/TD]
[TD](ZLBPWT-UNFL)[/TD]
[/TR]
[TR]
[TD](MO-345562)[/TD]
[TD]MO-345562 - Re[/TD]
[TD]SO-266368 [/TD]
[TD]ZLBPWT-UNFL, UNFLAVORED SPF LIP BALM WHITE TUBE [/TD]
[TD="align: right"]15000[/TD]
[TD="align: right"]2013-12-20[/TD]
[TD](ZLBPWT-UNFL)[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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