+ Reply to Thread
Results 1 to 4 of 4

Userform Dynamically Generated Combobox format value as date ("mm/dd/yyyy")

  1. #1
    Registered User
    Join Date
    04-27-2017
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    14

    Userform Dynamically Generated Combobox format value as date ("mm/dd/yyyy")

    I have coded my Userform to dynamically generate labels, textboxes and comboboxes depending on the number of data imported from the spreadsheet. I know i can format the combobox by change event but this does not seem to work on dynamically generated ones. Below is the code i use to generate the combobox:

    Please Login or Register  to view this content.
    I was told that as a work around, i can also convert my rowsource first to string though i am not sure how i should go about doing that too.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform Dynamically Generated Combobox format value as date ("mm/dd/yyyy")

    If you use the rowsource method to assign the values, then the rowsource needs to be modified to show the correct format of the data, since you can't modify the items in the combobox. The other option is to populate it by code. I assume "StartDate" is a named range... is it just one column? If so, you could try making a loop to go through the range and use .AddItem to add each value, which would allow you to use Format to control the formatting of the items being added.

    Something like:

    Please Login or Register  to view this content.
    Last edited by Arkadi; 05-12-2017 at 01:51 PM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    04-27-2017
    Location
    Philippines
    MS-Off Ver
    2013
    Posts
    14

    Re: Userform Dynamically Generated Combobox format value as date ("mm/dd/yyyy")

    This is really great help Arkadi!

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Userform Dynamically Generated Combobox format value as date ("mm/dd/yyyy")

    Glad it helped you out!
    Thanks for marking the thread as solved, and I appreciate the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 06-21-2016, 08:56 AM
  2. "Please enter a date in the format dd/mm/yyyy" error
    By marcelotero in forum Excel General
    Replies: 2
    Last Post: 08-18-2015, 12:23 PM
  3. [SOLVED] VBA Get the Date Format Change As "MM-DD-YYYY" In Range
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2014, 10:37 AM
  4. Geting headick to Format(Now, "dd.mm.yyyy hh:mm") inside a userform textbox!
    By Reemet in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-11-2014, 10:29 AM
  5. [SOLVED] UserForm - TextBox = Format("yyyy/mm/dd")
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 12:16 PM
  6. Replies: 3
    Last Post: 08-13-2013, 06:25 AM
  7. Replies: 0
    Last Post: 08-09-2012, 04:31 PM

Tags for this Thread

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