Add date to cell with a right mouse click

rirus

New Member
Joined
Dec 8, 2006
Messages
46
I want to select a function from a right mouse click that will place the current date in the selected cell.

Example:

1) Click on a cell
2) Perform a right mouse click
3) select the date function
4) the current date appears in selected cell

could this be set up so that the date function in the right mouse click only appears when specified cells are selected? Is this doable?


Rirus
 
Hi Bugelboy:

What columns do you want the date and time to be in? Let's say Column "E" for date and "F" for time. Your code would look like this (A simple version of the above)
Code:
Private Sub WorkSheet_BeforeDoubleclick(ByVal Target as Range,Cancel as Boolean)
Select Case Target.Column
    Case 5 : Target = Date   ' Set for Column 5 ("E")
    Case 6 : Target = Time   ' Set for Column 6 ("F")
    Case Else
End Select
Cancel = True
End Sub

Change Columns as needed.
HTH
lenze
 
Upvote 0

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Thanks a million rirus and lenze! All I had to do was save, close, and reopen it! Works wonders! I love this list!
 
Upvote 0

Forum statistics

Threads
1,224,513
Messages
6,179,214
Members
452,895
Latest member
BILLING GUY

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