+ Reply to Thread
Results 1 to 4 of 4

Multiple selection drop-down list

  1. #1
    Registered User
    Join Date
    01-05-2021
    Location
    Romania
    MS-Off Ver
    2016
    Posts
    6

    Multiple selection drop-down list

    Hi guys,

    I want a drop down list, with multiple selection, but i don't know how to make it to work in multiple cells, not only on "C2" like in this case.
    Thanks


    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Oldvalue As String
    Dim Newvalue As String
    Application.EnableEvents = True
    On Error GoTo Exitsub
    If Target.Address = "$C$2" Then
    If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
    GoTo Exitsub
    Else: If Target.Value = "" Then GoTo Exitsub Else
    Application.EnableEvents = False
    Newvalue = Target.Value
    Application.Undo
    Oldvalue = Target.Value
    If Oldvalue = "" Then
    Target.Value = Newvalue
    Else
    If InStr(1, Oldvalue, Newvalue) = 0 Then
    Target.Value = Oldvalue & ", " & Newvalue
    Else:
    Target.Value = Oldvalue
    End If
    End If
    End If
    End If
    Application.EnableEvents = True
    Exitsub:
    Application.EnableEvents = True
    End Sub
    Last edited by angelod; 02-06-2023 at 04:32 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Multiple selection drop-down list

    What range is "multiple cells"?
    If C2 and D2:
    using:
    PHP Code: 
    If Target.Address "$C$2" Or If Target.Address "$D$2" Then 
    If whole column C (column index = 3):
    using:
    PHP Code: 
    If Target.Column 3 Then 
    or
    If specific range(ex: C2:D100):
    using:
    PHP Code: 
    If Not Intersect(Targetrange("C2:D100")) is nothing then 
    Quang PT

  3. #3
    Registered User
    Join Date
    01-05-2021
    Location
    Romania
    MS-Off Ver
    2016
    Posts
    6

    Re: Multiple selection drop-down list

    I receive an error when i'm trying first option
    Capture.PNG

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Multiple selection drop-down list

    Opp, sorry, should be:
    PHP Code: 
    If Target.Address "$C$2" Or Target.Address "$D$2" Then 

+ 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. Multiple selection drop down list - remove a value
    By Terror9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2018, 09:42 AM
  2. [SOLVED] Multiple Selection Drop Down List
    By Terror9 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-15-2018, 03:57 AM
  3. [SOLVED] Need help having a drop down list change multiple cells depending on the list selection
    By jennis7242 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 08-12-2017, 01:20 PM
  4. Make same selection for multiple drop down list and clear all for all dropdown list
    By salomip13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-30-2014, 01:34 PM
  5. Multiple selection from drop down list
    By Dinny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2011, 11:12 PM
  6. How to make a multiple-selection drop down list?
    By Cuibi in forum Excel General
    Replies: 1
    Last Post: 06-24-2009, 01:09 AM
  7. [SOLVED] Drop Down list that enables multiple selection..
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2006, 07:50 PM

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