Cross Country Race Time

palaeontology

Active Member
Joined
May 12, 2017
Messages
444
Office Version
  1. 2016
Platform
  1. Windows
I have a spreadsheet that has a UserForm with 9 Command Buttons ... currently when one of the command buttons is pressed, it sends the specified name associated with that button to the first available cell in column B using the following code ..
Code:
Private Sub CommandButton2_Click()
Range("B65536").End(xlUp).Offset(1, 0) = "Cawley"
End Sub

What I would like to add to this is a timestamp of the button click event into the cell immediately to its right (in column C).

Can someone please help me amend my current code for each Command Button to perform this timestamp ?

Ultimately, I intend to turn this timestamp into a race finish time, as I'll be placing a race start clock into cell D4.

Very kind regards,

Chris
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi there. Modify your code like this:
VBA Code:
Private Sub CommandButton1_Click()
Range("B65536").End(xlUp).Offset(1, 0) = "Cawley"
Range("B65536").End(xlUp).Offset(0, 1) = Time()
End Sub
 
Upvote 0
How about
VBA Code:
Private Sub CommandButton2_Click()
   With Range("B" & Rows.Count).End(xlUp)
      .Offset(1) = "Cawley"
      .Offset(1, 1) = Time
   End With
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top