+ Reply to Thread
Results 1 to 3 of 3

Create Drop-down List with Excel VBA

  1. #1
    Registered User
    Join Date
    07-23-2019
    Location
    TW
    MS-Off Ver
    2016
    Posts
    12

    Create Drop-down List with Excel VBA

    I want to create a drop-down list in Cell E5.

    My range of values for the drop-down should come from Range(A1:A5) in Sheet2 and Range(C1:C7) in Sheet2. However, my code below is not working, it runs an error 1004 at Add xlValidateList, xlValidAlertStop, Operator:=xlBetween, Formula1:="=Sheet2!$A$1:$A$5 & Sheet2!$C$1:$C$7" I suspect it has something to do with this line...Formula1:="=Sheet2!$A$1:$A$5 & Sheet2!$C$1:$C$7" . Does anyone know how I can add two ranges into my Formula1?

    Also, I dont want the blanks in the ranges to appear in the Drop-down list but .IgnoreBlank = True still shows the blanks in the drop-down list. This is my code thus far, any help is genuinely appreciated:

    Please Login or Register  to view this content.
    Last edited by AliGW; 08-13-2019 at 12:48 PM.

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

    Re: Create Drop-down List with Excel VBA

    can you create a union of the ranges
    untested
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,493

    Re: Create Drop-down List with Excel VBA

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new, I have done it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. [SOLVED] Create an Excel Drop Down list with Search Suggestions ( Serachable Dropdown list )
    By PMH2384 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-11-2016, 12:03 AM
  2. how to create drop down list in excel with colors
    By kisanvikas2015 in forum Excel General
    Replies: 3
    Last Post: 05-21-2015, 08:53 AM
  3. Create a drop down list from other excel sheet
    By kisanvikas2015 in forum Excel General
    Replies: 2
    Last Post: 04-25-2015, 04:58 AM
  4. How to create drop down list in Excel where each list item is based on two columns?
    By matkiros in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2012, 08:50 AM
  5. Excel VBA Macro to create a drop down list
    By jeffgraser in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2009, 08:08 PM
  6. [SOLVED] How do I create a drop down list in Excel 2003
    By Lenny in forum Excel General
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM
  7. Is there a way to create a drop-down list of links in Excel?
    By t_boden in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2005, 03:06 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