advanced filter question

  • Thread starter Thread starter K7
  • Start date Start date
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.
 
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
 
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
 
Back
Top