+ Reply to Thread
Results 1 to 3 of 3

select multiple values from a cell data validation list dropdown

Hybrid View

SKooLZ select multiple values from a... 02-17-2017, 06:11 AM
Glenn Kennedy Re: select multiple values... 02-17-2017, 07:00 AM
SKooLZ Re: select multiple values... 02-23-2017, 08:15 PM
  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    select multiple values from a cell data validation list dropdown

    Hi all,

    I would like to be able to select multiple values from a cell data validation list dropdown which are then entered into the cell within the chosen column. This is the code I have come up with which works but it sometimes gets a runtime error and disables the code which then requires me to re-open the spreadsheet to get it working again. I welcome any ideas on how to prevent this in my code.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Dim oldVal As String
        Dim newVal As String
        Dim sComments As String
    
        If Target.Count > 1 Then Exit Sub
        If Target.Column = 10 Then
        
      On Error GoTo exit_Click_Err
    
        'If Target.Column <> 100 Then
            newVal = Target.Value
            If newVal <> "" Then
                Application.EnableEvents = False
                Application.Undo
    
                Else
                End If
                    
                oldVal = Target.Value
                If InStr(oldVal, newVal) = 0 Then
                    Target.Value = IIf(oldVal = "", "", oldVal) & ";" & newVal
                End If
                Application.EnableEvents = True
            End If
            
    exit_Click_Exit:
        Exit Sub
    
    exit_Click_Err:
        'MsgBox Error$
        Resume exit_Click_Exit
             
        End Sub
    For Info, the error normally occurs when I select the cell and hit delete key to delete any entries I have made and the error is : runtime error 1004 , method 'UNDO' of object '_Application failed'


    Thanks

    Skoolz
    Last edited by SKooLZ; 02-17-2017 at 06:26 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: select multiple values from a cell data validation list dropdown

    I'm not a VBA person... but this might be what you want.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    Re: select multiple values from a cell data validation list dropdown

    Awesome Glenn, thanks for the amended code, worked a treat.

+ 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. VBA to time stamp cells whose values are derived from a data validation dropdown list
    By Natures_Gift in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2016, 06:44 PM
  2. [SOLVED] Data validation dropdown list in cell IF...
    By jayherring86 in forum Excel General
    Replies: 6
    Last Post: 01-20-2015, 12:00 PM
  3. [SOLVED] Select multiple values from dropdown list
    By DiegoL in forum Excel General
    Replies: 3
    Last Post: 12-10-2014, 06:06 AM
  4. Replies: 1
    Last Post: 09-28-2014, 09:09 AM
  5. Select item of a dropdown list (data validation) and refresh one pivot table
    By ATN123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2014, 07:40 AM
  6. Replies: 8
    Last Post: 06-25-2014, 01:08 PM
  7. [SOLVED] Select item of a dropdown list (data validation) and refreshes values of all pivot tables
    By siroco79 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 03-06-2014, 05:35 AM

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