View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Lincoln Mark Lincoln is offline
external usenet poster
 
Posts: 227
Default Now Function Question

To put the current date into B1, just do this:

Range("B1").Value = Date

In VBA, Date returns the current system date.

Mark Lincoln

On Jun 22, 4:23 pm, Nausett wrote:
I'm trying to use the Now function in VBA. I continue to get a compile
error: Expected function or variable. The error highlights on the word, Now.
The formula below is an example of the code.

Sub Dateparttest()
Dim today
today = Month(Now)
Range("b1").Value = today

End Sub