Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 Advanced filter does not effect data list Jojon Excel Discussion (Misc queries) 1 September 5th 08 12:47 PM
Extracting results of Advanced Filter. [email protected] Excel Programming 2 June 2nd 07 12:54 AM
Why won't advanced filter return filter results? jaws4518 Excel Worksheet Functions 5 September 12th 06 06:11 PM
Need to Search Column then Paste Data at end of Row? Advanced Filter? [email protected] Excel Programming 1 May 13th 06 12:11 AM
refresh advanced filter results eagle Excel Discussion (Misc queries) 2 November 18th 05 09:15 AM


All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"