I need help editing my Macro.
The Macro currently works by pressing CTRL+F to open the search box which searches either REF1 or REF2.
If the information is found, it copies over to the next cell to basically show its there.
If the information is not found, It paste the data searched for in cell L4 so a label can be printed.
What I'm trying todo:
Remove the CTRL+F and basically run from a cell (lets say cell L18)
How ever, When scanned the scanner basically types in the numbers then presses enter/return.
I was wondering, Would it be possible to make it run like this.
Select cell L18 then keep scanning until either:
A) The list is done - nothing is missing
B) If REF1/REF2 doesn't match, pastes that data into cell L4 for a label to be printing.
I've tried to explain as best I can, I've added some screenshots and the macro.
Any help is appreciated !
A.png
B.png
Sub Extra_Missing_Item() Application.ScreenUpdating = False
Dim rangeToSearch As Range
With Sheets(1)
Set rangeToSearch = .Range("A2:B" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
Dim searchAmount As String
searchAmount = InputBox("Scan the REF1 or REF2:")
Dim cell As Range
Set cell = rangeToSearch.Find(searchAmount, LookIn:=xlValues)
With Sheets(1)
If Not cell Is Nothing Then
.Range("E" & cell.Row & ":G" & cell.Row).Value = _
.Range("A" & cell.Row & ":C" & cell.Row).Value
Else
MsgBox "REF1/REF2: " & searchAmount & " shouldn't be here"
.Range("L4").Value = searchAmount
Range("L9").Select
End If
End With
Application.ScreenUpdating = True
End Sub
Bookmarks