KishorKK Member Jan 30, 2017 #1 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 63.5 KB · Views: 6
Hi All, I would like to enter present time using VBA. Can anyone tell me i tried like this getting error "variable not found"
Monty Well-Known Member Jan 30, 2017 #3 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.
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.
Chihiro Excel Ninja Jan 30, 2017 #4 Just use NOW instead. 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: Jan 30, 2017
Just use NOW instead. 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