• adding a date to a user form (office 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » adding a date to a user form (office 2000)

    • This topic has 3 replies, 3 voices, and was last updated 22 years ago.
    Author
    Topic
    #386626

    how can i add a date to a user form each time it is use. so that it will show in an excel worksheet

    Viewing 0 reply threads
    Author
    Replies
    • #671558

      What do you mean by “add a date to a userform”?

      You can use the UserForm_Initialize event to set the text of a text box to the current date. If the text box is linked to a worksheet cell by its Control Source property, the cell will be updated automatically:

      Private Sub UserForm_Initialize()
      Me.TextBox1.Text = Date
      End Sub

      (Replace TextBox1 by the name of your text box)

      If this is not what you meant, please explain in more detail.

      • #671572

        thank you for such a speedy reply. what i am trying to say is that each time the form is used the date is placed in cell “J12” automatically without keying in anything.

        • #671588

          You could Change Hans’s ,code to read

          Private Sub UserForm_Initialize()
          Range(“J12”) = Date
          End Sub

          This will enter the date in J12 of the active sheet.

          Andrew C

    Viewing 0 reply threads
    Reply To: adding a date to a user form (office 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: