running clock in a cell

T

Ted

I have created a employee time sheet and let employee punch in/out by
pressing Ctrl+Shift+;. This works fine but occasionally they punch in wrong
time by manually typing in/out. Now I am using =NOW(), this work better then
Ctrl+Shift+;, only down side is employees have to press F9 to get a current
time. Is there any function that will re-calculate automatically. I am very
new to excel (2007). any comment and suggestion or answer will be greatly
appreciated. Thank you in advance.
 
S

Sheeloo

You can place a refresh button on the page and assign the following code to it;
Sub ForcedCalculation()
'Assumption - Cell A1 contains the time
Range("A1").Calculate
End Sub

or you can use the following code after adjusting for the range. This code
will refresh everytime anything changes in a cell in the range selected

Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range, MyCell As Range
Set MyCell = Target(1, 1)
Set MyRange = [A1:A10] 'define the range here
'
If Intersect(MyCell, MyRange) Is Nothing Then
'you know the cell is not in the range, so exit
Exit Sub
Else
'continue with your cell
With MyCell
'code here
End With
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top