More on the automatic time stamp...

D

Da Mann

Hello, everyone;
I got the time stamp to work. Now I'm looking to apply it to something
else - I'd like to have the time stamp add it's self when a check box (cell
E4) is checked. The time should display in cell G4. I hid cell F4, which
displays "TRUE" or "FALSE".

Thank you all very much for your help!
 
D

Dave Peterson

There are two checkboxes. One from the Forms toolbar and one from the
controltoolbox toolbar.

If you used the checkbox from the controltoolbox toolbar, then go into design
mode (icon on the control toolbox toolbar) and double click on the checkbox.

Paste this in:

'Option Explicit
'Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Application.EnableEvents = False
With Me.Range("g4")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
Application.EnableEvents = True
End If
'End Sub

(I commented out the "option explicit, private sub, and end sub" statements.
You should see the equivalent (for your checkbox name) when you double click on
it.

If you used a checkbox from the forms toolbar, then paste this into a general
module. Right click on your checkbox and choose assign macro. Choose this one:

Option Explicit
Sub CheckBox1_Click()
If ActiveSheet.CheckBoxes(Application.Caller) = xlOn Then
Application.EnableEvents = False
With ActiveSheet.Range("g4")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
Application.EnableEvents = False
End If

End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

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