palaeontology
Active Member
- Joined
- May 12, 2017
- Messages
- 444
- Office Version
- 2016
- Platform
- Windows
I have a userform that contains a command button with the following code ...
This code does two things ...
1. it timestamps the time into cell B1
2. it creates a running clock in cell B2, showing the current time.
How would I adjust that code to allow for the following two possibilities ...
1. if cell B1 already has a timestamp, provides a message that queries whether the user really does intend to over-ride the current timestamp. The message might read something like this ... "there is already a Start Time in that cell. Do you wish to over-ride it" and then allows the user to say 'yes' to overwrite it with the new current time timestamp, or 'no' to leave the timestamp as it is
or
2. if cell B1 is currently empty, proceed with the code as I currently have it (as seen above).
Kind regards,
Chris
VBA Code:
Private Sub CommandButton11_Click()
Range("b1").Value = Now()
Range("b2").Value = Now()
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"
End Sub
This code does two things ...
1. it timestamps the time into cell B1
2. it creates a running clock in cell B2, showing the current time.
How would I adjust that code to allow for the following two possibilities ...
1. if cell B1 already has a timestamp, provides a message that queries whether the user really does intend to over-ride the current timestamp. The message might read something like this ... "there is already a Start Time in that cell. Do you wish to over-ride it" and then allows the user to say 'yes' to overwrite it with the new current time timestamp, or 'no' to leave the timestamp as it is
or
2. if cell B1 is currently empty, proceed with the code as I currently have it (as seen above).
Kind regards,
Chris