+ Reply to Thread
Results 1 to 6 of 6

Automatic date or time in forms

  1. #1
    marjan
    Guest

    Automatic date or time in forms

    I'm trying to get an automatic date or time into a userform. Can someone help
    me with this.
    --
    Thanks,
    Marjan

  2. #2
    Registered User
    Join Date
    04-25-2005
    Posts
    99
    If you're wanting your DTPicker (or whatever you're using) to default to the current date, you can use the following code:

    Private Sub UserForm_Initialize()
    dtpDate.Value = Now
    End Sub


    HTH


    DejaVu

  3. #3
    Tom Ogilvy
    Guest

    Re: Automatic date or time in forms

    Private Sub Userform_Activate()
    label1.Caption = format(now,"mm/dd/yyyy hh:mm")
    End sub

    if you want it to update periodically, look at Chip Pearson's page on the
    use of OnTime. You could start it off in the activate event.

    http://www.cpearson.com/excel/ontime.htm

    --
    Regards,
    Tom Ogilvy


    "marjan" <[email protected]> wrote in message
    news:[email protected]...
    > I'm trying to get an automatic date or time into a userform. Can someone

    help
    > me with this.
    > --
    > Thanks,
    > Marjan




  4. #4
    marjan
    Guest

    Re: Automatic date or time in forms

    When I use this option users can not adjust this cell. How can I get it
    adjustable.
    --
    Thanks,
    Marjan


    "Tom Ogilvy" wrote:

    > Private Sub Userform_Activate()
    > label1.Caption = format(now,"mm/dd/yyyy hh:mm")
    > End sub
    >
    > if you want it to update periodically, look at Chip Pearson's page on the
    > use of OnTime. You could start it off in the activate event.
    >
    > http://www.cpearson.com/excel/ontime.htm
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "marjan" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'm trying to get an automatic date or time into a userform. Can someone

    > help
    > > me with this.
    > > --
    > > Thanks,
    > > Marjan

    >
    >
    >


  5. #5
    Tom Ogilvy
    Guest

    Re: Automatic date or time in forms

    Use a textbox instead:

    Private Sub Userform_Activate()
    Textbox1.Value = format(now,"mm/dd/yyyy hh:mm")
    End sub


    "marjan" <[email protected]> wrote in message
    news:[email protected]...
    > When I use this option users can not adjust this cell. How can I get it
    > adjustable.
    > --
    > Thanks,
    > Marjan
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > Private Sub Userform_Activate()
    > > label1.Caption = format(now,"mm/dd/yyyy hh:mm")
    > > End sub
    > >
    > > if you want it to update periodically, look at Chip Pearson's page on

    the
    > > use of OnTime. You could start it off in the activate event.
    > >
    > > http://www.cpearson.com/excel/ontime.htm
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "marjan" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I'm trying to get an automatic date or time into a userform. Can

    someone
    > > help
    > > > me with this.
    > > > --
    > > > Thanks,
    > > > Marjan

    > >
    > >
    > >




  6. #6
    Damon
    Guest

    Re: Automatic date or time in forms

    I have made use this line of code:-

    Textbox1.Value = format(now,"mm/dd/yyyy")

    to complete a textbox in a UserForm, however it only works for me some
    people on my team it seems. For others it brings up a Compile Error 'can't
    find Project or library..???

    Is this anything to do with Addins or Excel options?

    I have also used:-

    Textbox1.Value = Date

    but the effect seems to be the same. Can anybody help me understand why?
    or can I fill the textbox from a single cell on a sheet (with ' =Today() '
    in the cell)?

    I know this is an old thread but it shows that I do search for an answer
    before posting ;-)

    Thank you in advance

    Damon

    "Tom Ogilvy" wrote:

    > Use a textbox instead:
    >
    > Private Sub Userform_Activate()
    > Textbox1.Value = format(now,"mm/dd/yyyy hh:mm")
    > End sub
    >
    >
    > "marjan" <[email protected]> wrote in message
    > news:[email protected]...
    > > When I use this option users can not adjust this cell. How can I get it
    > > adjustable.
    > > --
    > > Thanks,
    > > Marjan
    > >
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Private Sub Userform_Activate()
    > > > label1.Caption = format(now,"mm/dd/yyyy hh:mm")
    > > > End sub
    > > >
    > > > if you want it to update periodically, look at Chip Pearson's page on

    > the
    > > > use of OnTime. You could start it off in the activate event.
    > > >
    > > > http://www.cpearson.com/excel/ontime.htm
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "marjan" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > I'm trying to get an automatic date or time into a userform. Can

    > someone
    > > > help
    > > > > me with this.
    > > > > --
    > > > > Thanks,
    > > > > Marjan
    > > >
    > > >
    > > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1