Match Date

  • Thread starter Thread starter Arawn
  • Start date Start date
A

Arawn

I'm creating a "time stamp" where when a button is pushed, the time is
stamped.

Column C holds the dates, column E has Start Time, column F has finish
time, and the reference cell is K1, which has todays date.

I was thinking that I could match K1 with the corresponding date in
column C, and put the time into E (or F) depending on whether the
Clock IN or Clock OUT button was pushed.

I'm stuck!

~Arawn
 
Private Sub ClockIN_Click()
Dim res as Variant
res = Application.Match(clng(Range("K1").Value2),Columns(3),0)
if not res is nothing then
cells(res,"E").Value = Time
else
msgbox "Date not matched"
end if
End Sub


Private Sub ClockOUT_Click()
Dim res as Variant
res = Application.Match(clng(Range("K1").Value2),Columns(3),0)
if not res is nothing then
cells(res,"F").Value = Time
else
msgbox "Date not matched"
end if
End Sub
 
Thanks for the fast response, Tom.

I input those VB codes into my sheet, and was greeted by an error upon
running: Error 424 Object Required

I'm using Excel 2003, if that's of any relevance.

When I go into debugging mode, the variable "res" is returning the
correct numeric value, so that part is working.

~Arawn
 
Try changing this in two spots:
From:
if not res is nothing then

to:
If IsError(res) = False Then

(2 spots)
 
Back
Top