Is there a way to return to a CommanButton after entering data? I am matching a barcode to a column of data, it automatically moves to the next column and enters a time/date stamp then moves to the next column for manually entering a sample weight. After entering the sample weight, I would like to return to the CommandButton to scan the next barcode.
This is what I have thus far:
Private Sub CommandButton1_Click()
Dim code AsVariant
Dim matchedCell AsRange
' set up errorhandling
On Error GoToBadEntry
code =InputBox("Please scan a barcode and hit enter if you need to")
' Exit ifcancelled
If code ="" Then Exit Sub
Set matchedCell =Range("B2:B1000").Find(what:=code, LookIn:=xlValues, lookat:=xlWhole,MatchCase:=True)
If Not matchedCellIs Nothing Then matchedCell.Offset(0, 1).Value = Now
matchedCell.Offset(, 2).Select
Exit Sub
This is what I have thus far:
Private Sub CommandButton1_Click()
Dim code AsVariant
Dim matchedCell AsRange
' set up errorhandling
On Error GoToBadEntry
code =InputBox("Please scan a barcode and hit enter if you need to")
' Exit ifcancelled
If code ="" Then Exit Sub
Set matchedCell =Range("B2:B1000").Find(what:=code, LookIn:=xlValues, lookat:=xlWhole,MatchCase:=True)
If Not matchedCellIs Nothing Then matchedCell.Offset(0, 1).Value = Now
matchedCell.Offset(, 2).Select
Exit Sub