PDA

View Full Version : [SOLVED:] Get datetimestamp in Excel through VB



BMD4
07-10-2018, 10:29 PM
Hi,

I have a scenario in excel,in which I click a button (Eg: Account), it displays list of accounts.
Along with this, I need to include a message which gives data time stamp.

When Account button is clicked, Sub Acc_Upd will be called which inturn calls AccountDet and displays accounts
and I get pop up with last refresh details. Instead of popup, I need &Now value in a different textbox.

Can anyone suggest how can I get &Now updated in a different text box when we click 'Account' button.

Sub Acc_Upd()

Call AccountDet

MsgBox "Last refresh was on " & Now

End Sub

georgiboy
07-10-2018, 11:13 PM
If the code is run from the Userform that has the textbox on then:


Me.Textbox1.Value = Now()

Otherwise:


Userform1.Textbox1.Value = Now()

Hope this helps

BMD4
07-11-2018, 02:16 PM
If the code is run from the Userform that has the textbox on then:


Me.Textbox1.Value = Now()

Otherwise:


Userform1.Textbox1.Value = Now()

Hope this helps

BMD4
07-11-2018, 02:17 PM
Thank you. That worked.