+ Reply to Thread
Results 1 to 3 of 3

Remove Item from Multiple ComboBoxes if it has been selected in another

  1. #1
    Registered User
    Join Date
    11-23-2018
    Location
    UK
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    2

    Remove Item from Multiple ComboBoxes if it has been selected in another

    I have a UserForm which contains 5 ComboBoxes. These ComboBoxes allow the user to select the outcome of the patient (more than one outcome is possible hence 5 ComboBoxes).

    The ComboBoxes are populated with items from a named range. If an item is selected in the first ComboBox then I want it to be removed in the other ComboBoxes to prevent duplication. However I don't know how to do this?


    Any help would be hugely appreciated.

    My items are listed in column A in a worksheet titled "Outcomes":
    I have to use a named range and not a fixed range as the user has the option to add a custom outcome which would get added to the last empty row of column A.

    Here is my code at UserForm_Initialize which populates the comboboxes:

    Dim ws As Worksheet
    Dim LastRow As Long
    Dim aCell As Range

    Set ws = Worksheets("Outcomes")

    With ws
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

    For Each aCell In .Range("A1:A" & LastRow)
    If aCell.Value <> "" Then
    Me.cbOutcome1.AddItem aCell.Value
    Me.cbOutcome2.AddItem aCell.Value
    Me.cbOutcome3.AddItem aCell.Value
    Me.cbOutcome4.AddItem aCell.Value
    Me.cbOutcome5.AddItem aCell.Value
    End If
    Next
    End With

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Remove Item from Multiple ComboBoxes if it has been selected in another

    How are you populating the comboboxes from the named range?

    PS When posting code can you please use CODE tags?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-23-2018
    Location
    UK
    MS-Off Ver
    Microsoft Office Professional Plus 2010
    Posts
    2

    Re: Remove Item from Multiple ComboBoxes if it has been selected in another

    Actually I don't think I've reference a named range I have just listed all cells in a column that aren't empty (code below):

    Please Login or Register  to view this content.

+ 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. Shopping Cart / Returning selected item on summary page from multiple tabs
    By jrubes77 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2017, 08:39 PM
  2. [SOLVED] VBA to remove item selected from ListBox and to find in row source and delete as well
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2016, 11:51 AM
  3. Display multiple value when item selected in drop down list
    By peter.lu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2015, 05:06 PM
  4. [SOLVED] Multiple cells selected by user, than remove last character
    By JPGraphX in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-06-2014, 01:07 PM
  5. Remove selected item from listbox
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-28-2014, 08:36 AM
  6. Remove an item from a validation list after selected?
    By hey_ray in forum Excel General
    Replies: 6
    Last Post: 02-23-2014, 05:18 PM
  7. Concantenating values selected from comboboxes
    By chris_norton in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2009, 09:10 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