Results 1 to 5 of 5

creating VB code using advanced search criteria with multiple data validation lists?

Threaded View

  1. #1
    Registered User
    Join Date
    05-26-2011
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2010
    Posts
    3

    creating VB code using advanced search criteria with multiple data validation lists?

    Hi,

    I've been reading through many forums and looking at many examples but still cannot find what I'm looking for. The closest I came to was one from Contextures - DataValSelectName.

    I'm trying to make a commercial invoice sheet where you can easily select particular brands, then in the second list, select a product from that brand. The problem I have is the list gets updated every week and it contains a thousand products, so I require something similar to how the DataValSelectName.xml works, but with multiple entries. Here is a link to the file in question here .

    I've included what I'm currently working on with comments to best help people work through what I've already done. Here is the code itself:

    Option Explicit
    ' Developed by Contextures Inc.
    ' www.contextures.com
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim wsSD As Worksheet
    Dim wsS As Worksheet
    Set wsSD = Sheets("StockList")
    Set wsS = Sheets("Commercial Invoice")
    
    If Target.Address = "$A$3" Then
      wsS.Range("B3").Value = "" 'Empties cell B3 when cell A3 is selected
      wsSD.Range("ProductList").AdvancedFilter _ 'Uses the named range "ProductList" for the range of the search
        Action:=xlFilterCopy, _
        CriteriaRange:=wsS.Range("A2:A3"), _ 'uses "Type" as the search column, then searches for whatever is in cell B3
        CopyToRange:=wsSD.Range("AA1"), Unique:=True 'Copies the search results to cell AA1 in the stocklist sheet
    End If
    
    End Sub
    The first line in the commercial invoice works, but I can't seem to get the other lines working. Thank you in advance for anyone reading this.
    Attached Files Attached Files
    Last edited by Jonathan Bay; 06-13-2011 at 04:30 PM.

Thread Information

Users Browsing this Thread

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

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