MS Excel: NOW Function (WS, VBA)
The Microsoft Excel NOW function returns the current system date and time. The NOW function will refresh the date/time value whenever the worksheet recalculates.
NOW Function (Syntax)
The syntax for the Microsoft Excel NOW function is:
The NOW function can be used in the following versions of Microsoft Excel:
- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Excel Function
The NOW function can be used in Microsoft Excel as:
- Worksheet function (WS)
- VBA function (VBA)
NOW Examples (as Worksheet Function)
Let's look at some Excel NOW function examples and explore how you would use the NOW function as a worksheet function in Microsoft Excel:
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.
NOW Examples (as VBA Function)
The NOW function can also be used in VBA code in Microsoft Excel.
Let's look at some Excel NOW function examples and explore how you would use the NOW function in Excel VBA code:
Dim LValue As Date LValue = Now
In this example, the variable called LValue would now contain the current system date and time.