Consulting

Results 1 to 4 of 4

Thread: Get datetimestamp in Excel through VB

  1. #1
    VBAX Regular
    Joined
    Jul 2018
    Posts
    7
    Location

    Get datetimestamp in Excel through VB

    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

  2. #2
    VBAX Expert
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    543
    Location
    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
    I was not told it was impossible, so i did it.

  3. #3
    VBAX Regular
    Joined
    Jul 2018
    Posts
    7
    Location
    Quote Originally Posted by georgiboy View Post
    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

  4. #4
    VBAX Regular
    Joined
    Jul 2018
    Posts
    7
    Location
    Thank you. That worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •