advanced filter question

K

K7

Hello all again,

I've got some data in column A, sheet3 and I have the following code (that
works without problem)

Sub FilterUniqueItems()

Dim i As Integer
Dim list As Variant
Dim DataRange As Range

Set DataRange = Worksheets("sheet3").Range("A1:A10")

list = DataRange.AdvancedFilter(Action:=xlFilterCopy,
Copytorange:=Worksheets("sheet3").Range("B1"), Unique:=True)

End Sub


Is it possible to determine (programatically, I mean) how many and what
values the advancedfilter extract? I'd like to treat the data before pasting
it into Excel.

Best regards.
 
D

Dave Peterson

After the filtered data is in column B, you could use:

with worksheets("sheet3")
msgbox .range("b2",.cells(.rows.count,"B").end(xlup)).cells.count
'or since you plopped the data into row 1
msgbox .cells("B1").end(xldown).row - 1
end with
 
K

K7

Thanks a lot Dave!!!

Best regards


Dave Peterson said:
After the filtered data is in column B, you could use:

with worksheets("sheet3")
msgbox .range("b2",.cells(.rows.count,"B").end(xlup)).cells.count
'or since you plopped the data into row 1
msgbox .cells("B1").end(xldown).row - 1
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top