Hi, I am looking for a solution to an issue I am having and saw you are quite active. I am now wondering if what I am asking is even possible. It may be something like the issue is far to complicated or far to simply to be resolved. I am just looking for a way to keep a macro limited to one open workbook while other workbooks are open and my experience with macros is extremely limited. I hope reaching out directly to you is OK, if not I apologize.
I am having issues with a workbook that you and others have helped me with in the past. I do not expect you to remember, but if you could take a look. I would appreciate it!
You helped me just now solve my problem (big thanks) but I can't see how to mark your answer as solution and/or mark thread as resolved. Can you advise?
I saw a post on jan 22 2020 aboout Date pickers. i am wanting to use one of the 2 examples you suggested but im not sure how to get them to work in a userform. Please help me if you can. What i want it to do is default to the current date when i open the userform.
I am desperate and have been looking around everywhere for a solution to my very similar problem and you might be my only hope! I am going to message the thread for the specifics. Thank you in advance for any support you could provide!
Just wanted to thank you for your prompt response. I didnt see a "thumbs up" like on the other two answers but nevertheless ................... thank you
Can you help me with my code. I"m having trouble writing the time out portion.
I have a time in and time out.
Code
Private Sub cmdLogin_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Attendance")
Application.ScreenUpdating = False
With Sheets("Attendance")
If empid = "" Then
MsgBox "Please Scan your ID", vbCritical, "Alert"
Else
' Find emtpy row
lRow = ws.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
'Add data to worksheet
ws.Cells(lRow, "A") = Me.txtEmp.Value
ws.Cells(lRow, "A").Offset(, 1).Value = Now
ws.Cells(lRow, "A").Offset(, 3).Value = Date
ws.Cells(lRow, "A").Offset(, 4).Value = Me.empid.Value
'Clear userform
txtEmp.Value = vbNullString
Me.empid.SetFocus
Application.ScreenUpdating = True
End If
End With
End Sub
Private Sub CommandButton1_Click()
Dim lRow As Long
Dim ws As Worksheet
Dim Emp
Dim MatchRow As String
Dim SearchTable As Range
Set SearchTable = Sheets("Attendance").Range("A2:A" & Sheets("Attendance").Range("A" & Rows.Count).End(xlUp).Row)
Set SearchTable1 = Sheets("Attendance").Range("E2:E" & Sheets("Attendance").Range("E" & Rows.Count).End(xlUp).Row)
Set ws = Worksheets("Attendance")
Application.ScreenUpdating = False
With Sheets("Attendance")
If empid = "" Then
MsgBox "Please Scan your ID", vbCritical, "Alert"
Else
If txtEmp.Value = "" Then
MsgBox "Please Select an Job Number.", vbCritical, "Alert"
Else
If WorksheetFunction.CountIf(.Columns(1), txtEmp) = 0 Then
MsgBox " You are NOT Timed-in", vbCritical, "Employee Time-Out"
Else
MatchRow = Application.WorksheetFunction.Match(txtEmp.Value, .Range(SearchTable.Address), 0) + 1
MatchRow = Application.WorksheetFunction.Match(empid.Value, .Range(SearchTable1.Address), 0) + 1
If .Cells(MatchRow, 3).Value <> "" Then
MsgBox " You are Already Timed-Out", vbCritical, "Employee Time-in"
Else
.Cells(MatchRow, 3).Value = Now
End If
'Clear userform
txtEmp.Value = vbNullString
Me.empid.SetFocus
Application.ScreenUpdating = True
End If
End If
End If
End With
End Sub
Display More
The time out portion: I want to be able to have multiple session of time in and out for same employee and Job specific. I can only do for single time out for same day. i don't know how to code it so it can accept new time out to another cell without overwrite previous session. I have the sample file in the Excel vba request for help. Please help me. Kind regards.