Results 1 to 3 of 3

Help needed with multiple selections from a created list - vba solution??

Threaded View

  1. #1
    Registered User
    Join Date
    03-05-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Help needed with multiple selections from a created list - vba solution??

    HI EXCEL COMMUNITY! I would like to be able to select multiple items from a list. In the attached file, I have my list, cells A3-A6. In cell C2 I have the option to select from a list. I would like cell C2 to show like cell F3. I would also like it to be available to the entire workbook. I have this programed so far in the VBA of the Workbook for columns 3 & 4, see below. However, the output isn't giving me the results I desire. Am I writing the VBA code incorrectly?

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Code by Sumit Bansal from https://trumpexcel.com
    ' To allow multiple selections in a Drop Down List in Excel (without repetition)
    Dim Oldvalue As String
    Dim Newvalue As String
    Application.EnableEvents = True
    On Error GoTo Exitsub
    If Target.Column = 3 Or Target.Column = 4 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
    Attached Files Attached Files
    Last edited by cabinet12; 12-25-2020 at 10:19 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 06-14-2019, 03:28 PM
  2. Help needed - List of names new excel to be created and saved
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2018, 10:31 PM
  3. Hyperlinking via/from Data Validation List? Only simple solution needed!
    By BrianLabigaliniKCC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2014, 11:29 AM
  4. Dynamic list solution needed...VLOOKUP?
    By drumbok5 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-23-2012, 12:42 PM
  5. List Box Selections Outputting Multiple Selections with One Click
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-21-2011, 12:27 PM
  6. Multiple selections from a pick list - only unique selections (no repeats) ?
    By opsayo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2011, 06:25 PM
  7. RE Excel: Once a list is created, how do you delete it if needed?
    By JNAY in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-08-2006, 12:45 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