+ Reply to Thread
Results 1 to 4 of 4

Custom Drop Down List

Hybrid View

  1. #1
    Registered User
    Join Date
    06-16-2014
    Location
    TX
    MS-Off Ver
    2010
    Posts
    27

    Custom Drop Down List

    Hi

    I would like to know if this is possible. In the " Notes" tab for the attached file I would like to create a drop down list populating the values from the "Parts" tab .

    Work ctr --- Should be populated with the unique values from Column A in the "Parts" tab

    Order --- Should be populated with the values from Column F but only for the Work ctr selected before.

    Any help or advise will be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Custom Drop Down List

    Try this code. Put them on the Worksheet_SelectionChange Event

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim wsParts As Worksheet, wsNotes As Worksheet
    Dim LR As Long, i As Long, j As Integer
    Dim colList As Collection
    Dim sList As String, sOrder As String
    
    Set colList = New Collection
    
    With ThisWorkbook
        Set wsParts = .Worksheets("Parts")
        Set wsNotes = .Worksheets("Notes")
    End With
    
    With wsParts
    LR = .Cells(Rows.Count, 1).End(xlUp).Row
    
        For i = 2 To LR
            If Not .Cells(i, 1).Value Like "*Total*" Then
                On Error Resume Next
                colList.Add .Cells(i, 1).Value, CStr(.Cells(i, 1).Value)
            End If
        Next i
        
        On Error GoTo 0
        
        For j = 1 To colList.Count
            sList = sList & "," & colList.Item(j)
        Next j
        
        sList = Right(sList, Len(sList) - 1)
        
    End With
    
    
    With wsNotes
        With .Range("A2").Validation
            .Delete
            .Add xlValidateList, xlValidAlertStop, xlBetween, sList
        End With
    End With
    
    With wsParts
        sOrder = ""
        
        For i = 2 To LR
            If .Cells(i, 1).Value = wsNotes.Range("A2").Value Then
                sOrder = sOrder & "," & .Cells(i, 6).Value
            End If
        Next i
        
        sOrder = Right(sOrder, Len(sOrder) - 1)
    End With
        
    With wsNotes.Range("B2").Validation
        .Delete
        .Add xlValidateList, xlValidAlertStop, xlBetween, sOrder
    End With
    
    End Sub
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-16-2014
    Location
    TX
    MS-Off Ver
    2010
    Posts
    27

    Re: Custom Drop Down List

    Works great . But how can I add more rows

    If I try dragging down or copying the row .The data for Order (Column B) is no longer populated with the corresponding information

    Thank you

  4. #4
    Registered User
    Join Date
    06-16-2014
    Location
    TX
    MS-Off Ver
    2010
    Posts
    27

    Re: Custom Drop Down List

    Any idea on how to solve the following messages ,

    Removed Feature: Data validation from /x/worksheets/sheets.xml part

    Its crashing when I close and reopen the file

+ 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. Drop-Down List with List and Custom Data Validation
    By KyleElliott in forum Excel General
    Replies: 4
    Last Post: 05-03-2014, 08:31 AM
  2. Replies: 5
    Last Post: 03-01-2012, 01:56 PM
  3. Custom Drop-Down List
    By jacqlee in forum Excel General
    Replies: 1
    Last Post: 02-11-2008, 04:30 PM
  4. Filter from custom drop down list
    By freebrownies in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2007, 04:31 PM
  5. [SOLVED] Create logical custom drop down list
    By AT in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-07-2005, 03:05 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