adding a non-formulaic time field

T

tjb

When my user clicks a command button I want the sheet to
enter the exact time they clicked the button into a cell
but I don't want it to update with the current time every
time the workbook is opened. I'm sure this is possible
but I am having difficulty figuring it out. Thanks so
much, you all are awesome!
 
J

Jason Morin

Sub CommandButton1_Click()
Dim rng As Range
Set rng = Sheets("Sheet1").Range("A1")
With rng
.Value = Now()
.NumberFormat = "mm/dd/yy h:mm:ss AM/PM"
End With
End Sub
 
T

tjb

This works great but now is there a way to add the time
that the user sends it as an email?

For instance, the user clicks the button and it enters
the time into a cell, then it launches an email with the
workbook attached. The user might leave the email open
for a few minutes before actually sending it to me. Can
I have the time that the user actually sends it captured
in a cell on the form?
 
T

tjb

Cool, I'll check it out.

Is there a way to make the code you gave below work when
the sheet is protected? It gives me an error when I try
to run it with the sheet protected. The cell that it
refers to is unlocked but that didn't seem to matter.
 

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