Start & Stop Time button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have made a worksheet to track my daily projects. Instead of typing the
date & time each time I switch tasks, I tried to create a button that I
would click. But when I close & open the form back up the last cell I
utilized the following code updates to the current time instead staying at
the original time.

Code Created:
Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
End Sub


Any help is appreciated, as always thank you to all that answer my questions!
 
It's updateing because you entering the formula now() so whenevr the sheet
recalculates it will update the value. Try:-

Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.Value = Time
End Sub

Mike
 
Thank you. So, since I do all the changes in the same day I would assume that
I would just have to put the data in a seperate cell. My current format looks
like this "03/26/2007 07:00"
 
Format cell as

dd/mm/yyyy hh:mm

and use

Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.Value = Date & Time
End Sub
 
add a line:

ActiveCell.Value = ActiveCell.Value

Making it:

Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Value = ActiveCell.Value
End Sub

HTH
Jim May
 
Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.Value = Now
End Sub

This puts the hard coded Date and Time in the cell as your code previously
did, but it doesn't recalculate. If that is what you are asking.
 
Thank you
--
Thanks,
Andy


JMay said:
add a line:

ActiveCell.Value = ActiveCell.Value

Making it:

Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Value = ActiveCell.Value
End Sub

HTH
Jim May
 
Thank you
--
Thanks,
Andy


Mike said:
Format cell as

dd/mm/yyyy hh:mm

and use

Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.Value = Date & Time
End Sub
 
Excellent, thank you. How do I learn more about these so I don't have to ask
such simple questions?
 

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

Back
Top