MS Excel: NOW Function (WS, VBA)
In Microsoft Excel, the NOW function returns the current system date and time. This function will refresh the date/time value whenever the worksheet recalculates.
The syntax for the NOW function is:
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
- VBA function (VBA)
Worksheet Function Example
Let's take a look at an example to see how you would use the NOW function in a worksheet:
The spreadsheet will continue to display this value, until the worksheet recalculates. By pressing the F9 key, you can force the worksheet to recalculate and the NOW function will update its value.
VBA Function Example
The NOW function can also be used in VBA code. For example:
Dim LValue As Date LValue = Now
In this example, the variable called LValue would now contain the current system date and time.