+ Reply to Thread
Results 1 to 6 of 6

Dependant Activex ComboBox duplicating the items

  1. #1
    Registered User
    Join Date
    05-18-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    3

    Dependant Activex ComboBox duplicating the items

    Hello All

    I have 3 activex combobox in a spreadsheet. One for Region, another for Country and a last one for City. The region depends on the selection in the list country, and the city depends on the selection in region.

    I have 3 dependent named ranges that are populated by a macro in a different spreadsheet. Example:

    DESCTY =OFFSET(DesReg_Start,(MATCH(FreightCalculator!$A$14,DesReg_Column,0)-1),1,COUNTIF(DesReg_Column,FreightCalculator!$A$14),1)

    Then another macro populates the combo box like this:

    ComboBox9.ListFillRange = "DESCTY"

    It works, but for some reason, the list of restricted Cities is showing more than one time. For example, if the Region selected is US East Coast, then it should show
    Baltimore
    Boston
    Buffalo
    .
    .

    But instead, it is showing

    Baltimore
    Boston
    Buffalo
    .
    .
    Baltimore
    Boston
    Buffalo
    .
    .
    Baltimore
    Boston
    Buffalo
    .
    .

    The dependent named range works fine. It shows correctly, but for some reason when it is feed to the combo box it duplicates it several times

    What could be causing this issue?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Dependant Activex ComboBox duplicating the items

    Please Login or Register  to view this content.
    The above code is not the syntax to define a named range. It sets a variable called DESCY, not a named range. Though they may share the same name, a variable and a named range are two separate things. I suspect your code is setting a variable, but the combobox is using a previously defined named range.

    Something like this would be the syntax to define a Named Range.
    It presumes that DesReg_Start and DesReg_Column are range variables within the code.
    Note: I'm not sure if this formula is exactly right based on the limited information provided.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-18-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    3

    Re: Dependant Activex ComboBox duplicating the items

    Hello

    The line
    DESCTY =OFFSET(DesReg_Start,(MATCH(FreightCalculator!$A$14,DesReg_Column,0)-1),1,COUNTIF(DesReg_Column,FreightCalculator!$A$14),1)

    is not VBA. It is the way I defined the named range in Excel so it is a dependent drop down list

    I am using VBA to assign the named range to the activex control

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Dependant Activex ComboBox duplicating the items

    DESCTY =OFFSET(DesReg_Start,(MATCH(FreightCalculator!$A$14,DesReg_Column,0)-1),1,COUNTIF(DesReg_Column,FreightCalculator!$A$14),1)

    This is a guess: you use other named ranges to define DESCTY. Perhaps you use DESCTY to define the other named ranges and that creates a circular reference?

  5. #5
    Registered User
    Join Date
    05-18-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    3

    Re: Dependant Activex ComboBox duplicating the items

    Hello
    I don't think the problem is the named range. When I select a country from the drop down "Country", and I go to Name Manage in Excel and select DESCTY it highlights the correct range in Excel...

    I am really at lost here..

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Dependant Activex ComboBox duplicating the items

    I don't knw either.

    Maybe try clearing the combobox first.

    ComboBox9.Clear
    ComboBox9.ListFillRange = ""
    ComboBox9.ListFillRange = "DESCTY"

+ 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. ActiveX ComboBox Control: add items without using ListFillRange Property
    By Axmed.cm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2016, 09:53 AM
  2. Replies: 0
    Last Post: 10-26-2015, 04:25 PM
  3. [SOLVED] Dependendent ActiveX Combobox Limited To 8 Items In List
    By OzTrekker in forum Excel General
    Replies: 5
    Last Post: 09-27-2015, 01:40 AM
  4. Multiple ActiveX ComboBox's w/several items - Is it possible to shorten?
    By ocnmel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2015, 12:44 PM
  5. ActiveX combobox datalist dependant on previous combobox selections
    By Mrs Poodle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2014, 07:07 AM
  6. [SOLVED] fill listbox (ActiveX) based combobox (ActiveX)
    By elsg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2014, 11:25 AM
  7. [SOLVED] Make combobox list options dependant on selection in another combobox within a userform
    By Vladimir_Dobvchenko in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 05:30 AM

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