Greetings friends,
I have limited excel knowledge and experience, yet despite that, through the painstaking process of searching online forums such as this one, i have managed to create a "Employee Punch in/out" userform. So far i am happy with it.
Here is how it works:
A employee types in his Last Name in textbox1, then his First in textbox2.
Then the employee clicks the command Button
this causes his last name, first name, date and tme to populate an excel spread sheet by row-
(i've managed to create and attach the VBA coding for time and date to automatically generate for this and it works Great)
Here is my problem:
for the employee to punch "out", i need code for excell to identify the employee by his last name in column " a" and first name in column "b" and not simply populate another row that way the OUT time populates in the same row as the in time.
here is my coding so far:
</DIV><!-- BEGIN TEMPLATE: bbcode_php -->
I have limited excel knowledge and experience, yet despite that, through the painstaking process of searching online forums such as this one, i have managed to create a "Employee Punch in/out" userform. So far i am happy with it.
Here is how it works:
A employee types in his Last Name in textbox1, then his First in textbox2.
Then the employee clicks the command Button
this causes his last name, first name, date and tme to populate an excel spread sheet by row-
(i've managed to create and attach the VBA coding for time and date to automatically generate for this and it works Great)
for the employee to punch "out", i need code for excell to identify the employee by his last name in column " a" and first name in column "b" and not simply populate another row that way the OUT time populates in the same row as the in time.
here is my coding so far:
PHP:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
MsgBox "Please enter Required Information"
Exit Sub
End If
If Trim(Me.TextBox2.Value) = "" Then
Me.TextBox2.SetFocus
MsgBox "Please enter Required Information"
Exit Sub
End If
'copy the data to the database
ws.Cells(iRow, 1).Value = Me.TextBox1.Value
ws.Cells(iRow, 2).Value = Me.TextBox2.Value
ws.Cells(iRow, 3).Value = Date
ws.Cells(iRow, 4).Value = Time()
'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End Sub
Private Sub CommandButton2_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(0).Row
If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
MsgBox "Please enter Required Information"
Exit Sub
End If
If Trim(Me.TextBox2.Value) = "" Then
Me.TextBox2.SetFocus
MsgBox "Please enter Required Information"
Exit Sub
End If
'clear the data
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
ws.Cells(iRow, 5).Value = Time()
End Sub
[IMG]http://www.excelforum.com/images/styles/Skylight/misc/progress.gif[/IMG]