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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Lewis365

New Member
Joined
Feb 2, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
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.
 

Lewis365

New Member
Joined
Feb 2, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Would like to bump this as it has fallen down the threads and I am still unable to resolve it.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,201
Messages
5,640,816
Members
417,168
Latest member
StumpoC

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
Top