Using front end formula in vba

MattNewby

Board Regular
Joined
Dec 15, 2009
Messages
155
Hi,

Please can someone advise how I correct the following code, so that it will allow me to use a front end formula in VBA.

Code as follows:

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
ActiveCell = today()
End Sub

Thanks
Matt
:banghead::banghead::banghead:
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Or you can create you own function Today:
Code:
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
    ActiveCell = Today
End Sub

Function Today() As String
    Today = DateValue(Now)
End Function
 
Upvote 0
Adding 'Application' before Excel function uses the application object to allow usage of that function in a VBA code i.e.

Code:
A = Application.Sum(Range("K1:M1"))

A = Application.Average(Range("K1:M1"))

Dim Res As Variant
Res = Application.VLookup(123,Range("A1:C100"),3,FALSE)

etc.
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

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