Insert date/user when double click cells within column

Tom98

New Member
Joined
Oct 26, 2020
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi,

I would like my work sheet to populate the double clicked cell with the username when double clicking any cells within column BX and populate the double clicked cell with the date when double clicking any cells within column BW.

Or even better, to update both username and date in the specific row when either BX or BW are double clicked.

Many thanks :)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
update both username and date in the specific row when either BX or BW are double clicked.
Try

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Columns("BW:BX")) Is Nothing Then
    Cancel = True
    Intersect(Target.EntireRow, Columns("BW:BX")).Value = Array(Environ("username"), Date)
  End If
End Sub
 
Upvote 0
Peter,

That works perfectly.

Thank you very much!
 
Upvote 0
You are welcome. Thanks for the follow-up. :)
 
Upvote 0
@Peter_SSs
Thank you for solving this. I used the above code for some of my project and adapt. Can this be expanded to include 3 seperate "double clicks"? Column A - one set of users will double click and sign off, Column B - second set of users will double click and sign off, Column C - Users will double click to fill out that row.
 
Upvote 0
@Peter_SSs - Figured it out
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Columns("A:A")) Is Nothing Then
    Cancel = True
    Intersect(Target.EntireRow, Columns("A:A")).Value = Array(Environ("username") & " (" & Date & ") (" & Time & ")")
  End If
    If Not Intersect(Target, Columns("B:B")) Is Nothing Then
    Cancel = True
    Intersect(Target.EntireRow, Columns("B:B")).Value = Array(Environ("username") & " (" & Date & ") (" & Time & ")")
  End If
      If Not Intersect(Target, Columns("C:C")) Is Nothing Then
    Cancel = True
    Intersect(Target.EntireRow, Columns("C:C")).Value = Array(Environ("username") & " (" & Date & ") (" & Time & ")")
  End If
End Sub
 
Upvote 0
@Peter_SSs - Figured it out
Good news!

However, you could also consider this much shorter version (check the date format that you want). :)

BTW, I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  If Not Intersect(Target, Columns("A:C")) Is Nothing Then
    Cancel = True
    Target.Value = Environ("username") & Format(Now, " (dd/mm/yyyy) (hh:mm:ss AM/PM)")
  End If
End Sub
 
Upvote 0
Thanks for updating your profile details. (y)
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

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