• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Present Time Enter using VBA

KishorKK

Member
Hi All,


I would like to enter present time using VBA. Can anyone tell me i tried like this getting error "variable not found"
 

Attachments

  • upload_2017-1-30_21-29-33.png
    upload_2017-1-30_21-29-33.png
    63.5 KB · Views: 6
Hello Kishore..

Try this.

Sub test()
Dim dt as date
Dt=Date
Msgbox dt
End Sub

This msgbox gives u date n time...instead give cell references to display on excel sheet and format if i want only date.
Sorry Guys provided code for not giving in code mode.
 
Just use NOW instead.

upload_2017-1-30_11-54-30.png

Edit:
@Monty
Date will only return date (1/30/2017 for an example).
Now will have both date and time.

Edit2:
Alternately you can do something like below.
Code:
Sub Test()
Debug.Print Date + Time
End Sub
 
Last edited:
Back
Top