1. First select all the cells and unlock them (Format
Cells Protection tab).
2. Go to View Toolbars and select "Control Toolbox".
3. Click on the command button icon once and draw a
button on your worksheet.
4. Right-click the button and go to "View Code". Paste in
the following:
Private Sub CommandButton1_Click()
With ActiveSheet
.Unprotect Password:="sesami"
With [J1]
.Value = Now
.NumberFormat = "mm/dd/yy h:mm AM/PM"
.Locked = True
End With
.Protect Password:="sesami"
End With
End Sub
5. Press ALT+Q.
6. Right-click on the button again, go to Properties, and
change the Caption property. Exit Properties.
6. Click on the icon "Exit Design Mode" on the Control
Toolbox toolbar.
7. Close the toolbar.
HTH
Jason
Atlanta, GA
-----Original Message-----
We have a worksheet that we want users to be able to
press a button on the
worksheet & which in the next cell near the button, it
would stamp the
current time and/or date from the system. Then the cell
with the date and/or
time would be unable to be changed once the button is
pressed (locked)
.
|