Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill 2 column list box with Advanced Data Filter results
I would like to fill a 2 column ListBox with unique items obtained from
Advanced Data Filter. Here is the code that puts my Advanced Data Filter results on the worksheet: Range("MyRange").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range _ ("CritRange"), CopyToRange:=Range("ExtractRange"), Unique:=True I would like those results to be displayed directly in a 2 column ListBox, without having to display them first on the worksheet. Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill 2 column list box with Advanced Data Filter results
just filter the data to a hidden sheet.
something like following may do what you want. Adapt as required. Sub FilterData() Dim ws1 As Worksheet Dim ws2 As Worksheet Dim rng As Range Set ws1 = Worksheets("Sheet1") Set ws2 = Worksheets("Sheet2") ws1.Range("MyRange").AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:= _ ws1.Range("CritRange"), _ CopyToRange:= _ ws2.Range("A1"), _ Unique:=True With ws2 Set rng = .Range(.Cells(2, 1), .Cells(.Rows.Count, 2).End(xlUp)) End With With UserForm1 With .ListBox1 .ColumnCount = 2 .RowSource = rng.Address .ColumnHeads = True .ColumnWidths = "100;100" End With .Show End With rng.ClearContents End Sub -- jb "John" wrote: I would like to fill a 2 column ListBox with unique items obtained from Advanced Data Filter. Here is the code that puts my Advanced Data Filter results on the worksheet: Range("MyRange").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range _ ("CritRange"), CopyToRange:=Range("ExtractRange"), Unique:=True I would like those results to be displayed directly in a 2 column ListBox, without having to display them first on the worksheet. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 Advanced filter does not effect data list | Excel Discussion (Misc queries) | |||
Extracting results of Advanced Filter. | Excel Programming | |||
Why won't advanced filter return filter results? | Excel Worksheet Functions | |||
Need to Search Column then Paste Data at end of Row? Advanced Filter? | Excel Programming | |||
refresh advanced filter results | Excel Discussion (Misc queries) |