The ideas is to prompt out a input box that ask the user to key in ID, number only value. then it will auto search for a first blank cell founded in column H to allow the barcode enter from there. while the user is key in the barcode away from the PC using Bluetooth barcode scanner, the excel must not close by others user. to close it, user must enter the same ID The code only work until the enter value is true then it wont select the cell


Sub Enter_1()
Dim data_1 As String
Dim sCell As Variant
Dim rslt As Boolean


Do
data_1 = InputBox(Prompt:="Enter Employee No.", Title:="Employee", Default:="Enter Employee No. here")
If data_1 = "" Then
QuestionToMessageBox = "Exit?"
YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "Cancel")
End If
If YesOrNoAnswerToMessageBox = vbNo Then
data_1 = InputBox(Prompt:="Enter Employee No.", Title:="Employee", Default:="Enter Employee No. here")
Else
Exit Sub
End If
rslt = False
If Not IsNumeric(data_1) Then
MsgBox "You can only enter a number in this field"

rslt = True
Run (rowCount = Cells(Rows.Count, sourceCol).End(xlUp).Row)
End If
Loop While rslt


End Sub
Public Sub MessageBoxYesOrNoMsgBox()

Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String


End Sub
Public Sub SelectFirstBlankCell()
Dim sourceCol As Integer, rowCount As Integer, currentRow As Integer
Dim currentRowValue As String
sourceCol = 8 'column H has a value of 8
rowCount = Cells(Rows.Count, sourceCol).End(xlUp).Row

'for every row, find the first blank cell and select it
For currentRow = 1 To rowCount
currentRowValue = Cells(currentRow, sourceCol).Value
If IsEmpty(currentRowValue) Or currentRowValue = "" Then
Cells(currentRow, sourceCol).Select
End If
Next
End Sub
Sub Enter_2(ByVal data_1 As Long, ByRef data_1 As Long)
Dim data_2 As String
Dim rslt As Boolean

Do
data_2 = InputBox(Prompt:="Enter Employee No.", _
Title:="Employee", Default:="Enter Enter Employee No. here")
If data_2 = "" Then MsgBox ("Cancel")
Exit Sub

rslt = False
If Not IsNumeric(data_2) Then MsgBox "You can only enter a number in this field"
If rslt = True Then
End If
Loop While rslt

If data_2 <> data_1 Then MsgBox "Enter correct E.No"
End If

End Sub

Private Sub Force(ByVal data_1 As Long, ByRef data_2 As Long)
Dim cancel As Boolean
Dim allow_close As Boolean

If data_1 = data_2 Then
allow_close = True
Else
allow_close = False
End If
End Sub