+ Reply to Thread
Results 1 to 8 of 8

Is it possible to create a dropdown list with VBA?

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    23

    Question Is it possible to create a dropdown list with VBA?

    Hey all,

    I am making a worksheet, that when a button is clicked, it creates a new sheet and populates some of the cells. I would like to add a dropdown list as well, so that users can choose from a defined list of categories for the entry.

    Basically, I was wondering if it is possible to create a new droplist exclusively with VBA (using data validation each time is not an option) on each new form with a given set of data?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Is it possible to create a dropdown list with VBA?

    Hello & Welcome to the Forum,

    Sounds possible, but it would help to see a sample worksheet with: layout, type of data, what you want in the drop down, etc?
    HTH
    Regards, Jeff

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Is it possible to create a dropdown list with VBA?

    are these new created sheets in the same workbook??

  4. #4
    Registered User
    Join Date
    06-06-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Is it possible to create a dropdown list with VBA?

    Hmm, I may be forum-ly challanged, because I don't see a link to attach the workbook.

    Pretty much what I am trying to do is, when this button creates a new worksheet, I would like to add a dropdown menu in one of the cells that uses a named array as its data. The named array is a dynamic list based off of data in another worksheet.

    So far I've found the code:
    Please Login or Register  to view this content.

    This creates a drop down menu in cell 1,1, but I cannot seem to get that drop down to reference the named array "bleh" as its data.

    And yes, these worksheets are in the same workbook

    Any input?
    Last edited by Leith Ross; 06-06-2012 at 12:12 PM. Reason: Added Code Tags

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Is it possible to create a dropdown list with VBA?

    Hello construct ,

    To Attach a File:

    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    06-06-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Is it possible to create a dropdown list with VBA?

    Hey thanks, I've attached it to this post.

    The code for the button is in the worksheet page, which is where I would like to add the dropbox code.

    When you create a new sheet through the button, I would like there to be a dropdown at the end of the "product" "company" etc. headings so that the user can select a subcategory to file the product under. Eventually I would like to have that selection automatically place the product name in the corresponding subcategory dynamic array
    Attached Files Attached Files

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Is it possible to create a dropdown list with VBA?

    Try this update. When you create a new sheet a drop down for subcategories will be added to column I.

    Hopefully you can follow the code and place any more you may need, but it not, post back and we will see what we can do.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-06-2012
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Is it possible to create a dropdown list with VBA?

    I played with the code a bit and got everything working! I really appreciated it, y'all are life savers

    The code
    Please Login or Register  to view this content.
    Last edited by construct; 06-06-2012 at 03:34 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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