Hi there,
I am building a timeclock, and am using a user form to allow people to sign in/out.
I have a punch in form that logs the inputed username and password (after being checked against my employee list), along with a count of their username on this sheet (as a count of how many times they have punched in) and a timestamp (column 4). These values are all pasted to the first blank row in my worksheet "PunchInTimes".
Then, I have a punch out button that logs these same values the same way, only on "PunchOutTimes". Then, the idea is to link the index number of the PunchOutTimes record and PunchInTimes record for any given user, so that when they punch out, a complete record is pasted (to the first blank row) in a separate worksheet called "Timesheets".
I have been able to paste the username and count to the "Timesheets" sheet, however as soon as I try to index/match the count and inputed username (on the punch out form), I get an error 13 type mismatch.
I'm trying to paste the corresponding punch in time to this punch out time, so ive used an index/match with two columns (username and count) found in "PunchInTimes", and try to return the corresponding 4th column value (punch in time). After pasting the "punch out only" values to the PunchOutTimes, i used a "With/End With" statement, and set wsc equal to my 'timesheets' worksheet at the beginning of my code. So the line where I get my error is below in bold:
With wsc
.Cells(iRow, 1).Value = WorksheetFunction.Index(Worksheets("PunchInTimes").Range("A2:D10000"), WorksheetFunction.Match(Me.txtUsernameO.Value & .Cells(iRow, 3).Value, Worksheets("PunchInTimes").Range("A2:A10000") & Worksheets("PunchInTimes").Range("C2:C10000"), 0), 4)
End With
Again,
Everything else works correctly, so "wsc" is defined correctly, the problem has to do with doing a Match formula with 2 columns.
Any feedback is appreciated,
Thank you,
Connor
Bookmarks