Showing the date and time in separate cells with one double click

Lewis365

New Member
Joined
Feb 2, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi I am trying to get the time to display on a checklist I am creating in a separate cell to the date off the back of a double click fucntion.

I am able to get it to appear but the time is showing as 00:00:00 rather than the showing the time - I am happy for this to be reduced to just hours and minutes.

Below is what I have


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If ActiveCell.Column = 12 Then
ActiveCell.Offset(0, 1).Value = Application.UserName
ActiveCell.Offset(0, 2).Value = Format(Now, "dd/mm/yyyy")
ActiveCell.Offset(0, 3).Value = Format(Time, "hh/mm/ss")
End If

End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Sorry i should add I also wish to protect the offset cells so they cant be edited, when i do this, i get a runtime error currently.
 
Upvote 0
Would like to bump this as it has fallen down the threads and I am still unable to resolve it.
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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