Tomorrows Date - double click

trevolly

Board Regular
Joined
Aug 22, 2021
Messages
120
Office Version
  1. 365
Platform
  1. Windows
Hi all

Can I ask for some help on this vba code? I'm trying to set up a code for when I double click on a cell it enters tomorrows date (not tomorrow, the 16/09 but whatever the next days date is) This code brings up an error ...... "Compile Error: Ambiguous name detected: Worksheet_BeforeDoubleClick

Cheers all
T

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Date stamp
If Not Intersect(Target, Range("D20")) Is Nothing Then
Cancel = True
Target.Value = Today() + 1
End If
End Sub
 
TODAY() is an Excel function, not a VBA one.
The VBA equivalent is DATE().

Sorry I didn't notice it earlier. I just copied over what you had, assuming that you already had that part working.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Thank you so much @Joe4 . My project is complete - everyone on the forum have been absolutely invaluable! Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,699
Members
449,048
Latest member
81jamesacct

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