bobsburgers
Board Regular
- Joined
- Jun 25, 2017
- Messages
- 60
Hi, all -
I'm having difficulty with the second InputBox in my code.
Ideally when asked for the "Employee ID Number," the user would scan a barcode to populate a corresponding cell in Column C; however, although I can get the scanner to read and recognize the barcode on the ID cards, the ID number does not populate its respective cell.
The macro then loops back to the search function, as planned.
Here's the code I'm working with:
Please let me know if you can catch my mistake(s)! haha
Best,
bob
I'm having difficulty with the second InputBox in my code.
Ideally when asked for the "Employee ID Number," the user would scan a barcode to populate a corresponding cell in Column C; however, although I can get the scanner to read and recognize the barcode on the ID cards, the ID number does not populate its respective cell.
The macro then loops back to the search function, as planned.
Here's the code I'm working with:
Code:
Sub iPad_SignOut()
Dim scanstring As String
Dim foundscan As Range
Dim ws As Worksheet
Dim foundscan_address As String
Dim myValue As Variant
Set ws = ActiveSheet
scanstring = InputBox("Please enter a value to search for", "Enter value")
If scanstring = "" Then Exit Sub
With ws.Columns("A")
Set foundscan = .Find(What:=scanstring, LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not foundscan Is Nothing Then
foundscan_address = foundscan.Address
Do
foundscan.Offset(0, 1).Value = Now
ws.Activate
foundscan.Activate
ActiveWindow.ScrollRow = foundscan.Row
Set foundscan = .FindNext(foundscan)
ActiveCell.Offset(0, 2).Activate
myValue = InputBox("Please enter Employee ID Number", "Enter value")
Loop While Not foundscan Is Nothing And foundscan.Address <> foundscan_address
Else
MsgBox scanstring & " was not found"
End If
End With
Call iPad_SignOut
End Sub
Please let me know if you can catch my mistake(s)! haha
Best,
bob