+ Reply to Thread
Results 1 to 11 of 11

User form - Calendar drop down box

  1. #1
    Forum Contributor
    Join Date
    03-16-2009
    Location
    NC
    MS-Off Ver
    Office 2016
    Posts
    164

    User form - Calendar drop down box

    Hi,

    I am working in a userform and I need to find out how I could set a field for date and have a calendar drop down in it?

    Any ideas or codes anyone?

    Thanks in advance!
    Last edited by sentinela; 04-27-2009 at 03:28 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User form - Calendar drop down box

    You can use a datepicker control, but be aware this control is not always available on every computer. To find it To add one to your userform right click on the ToolBox in the VBA editor & choose Additional Controls. There's an alternative here or here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    03-16-2009
    Location
    NC
    MS-Off Ver
    Office 2016
    Posts
    164

    Re: User form - Calendar drop down box

    Hey RoyUK....

    Thanks for the reply. I am not sure if I didn't understand you correctly, but here is my spreadsheet.
    If you could kindly look at the code and tell me where I messed up, I would greatly appreciate...

    Thanks for the help!
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User form - Calendar drop down box

    If you are trying to use the calendar form example then you haven't copied all the code - you need the Class module as well and the userform

    The combobox one may be simpler for you to adapt.

    Also, why are you using Application, refer to thde UserForm with the key word Me.

    You can't use target with a UserForm, you would use something like Activecell or Selection.
    Last edited by royUK; 04-27-2009 at 03:03 PM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User form - Calendar drop down box

    I've just noticed that you have named the userform application, you can't do that because application is reserved by Excel to refer to the Excel Application

  6. #6
    Forum Contributor
    Join Date
    03-16-2009
    Location
    NC
    MS-Off Ver
    Office 2016
    Posts
    164

    Re: User form - Calendar drop down box

    I appreciated the help, and your patience in my learning...
    I used application because I didn't know I could use Me as keyword.
    How about if I have 2 or 3 forms, what would the keyword be for the others?

    I actually just want to have the calendar drop down in the ComboBox2.
    Do I just copy your form and paste there?
    Thanks again for all your help!

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User form - Calendar drop down box

    I've amended your code but it's not clear what your form is intended to do.
    Attached Files Attached Files

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: User form - Calendar drop down box

    How about if I have 2 or 3 forms, what would the keyword be for the others?
    Me.

    Me in a sheet module refers to the associated sheet; in ThisWorkbook, refers to ThisWorkbook; and in the code module of a form, refers to the form.

    To refer to another form's control, use instead the form name, e.g., UserFormx.TextBox1.

    But it's bad practice -- only code in the form's code module should refer it its controls. That gives code a measure of modularity, reducing the scope of changes if the controls on a particular form change.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: User form - Calendar drop down box

    I'm not clear what you want to do, you cannot add a date control to the combobox.

    Have a look at the examples

  10. #10
    Forum Contributor
    Join Date
    03-16-2009
    Location
    NC
    MS-Off Ver
    Office 2016
    Posts
    164

    Re: User form - Calendar drop down box

    Dear RoyUK.... That's exactly what I wanted....

    Wonderful.... Thanks for the major help, you have no idea how this got me so happy to see it working.

    shg...
    Thanks for the good explanation.
    I take it, that you are telling me not to use Me.... is that correct? Or if this was your project, what would you use?

    Thank you so much for all the help!

  11. #11
    Forum Contributor
    Join Date
    03-16-2009
    Location
    NC
    MS-Off Ver
    Office 2016
    Posts
    164

    Re: User form - Calendar drop down box

    Roy...
    That is just a invoice system that I am creating. The date is just for reference. There is nothing into it. After the done button is clicked, it is just going to summarize for me in another sheet.

    I am sure you will see more questions on this project, since I am just now learning VBA.

    Again, thanks for the help.

+ 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