Hi Forum
I need to check if any rows were returned by an advancedfilter. If any are returned - doesn't matter how many - then I will do some processing otherwise I just exit.
The problem is that although I see records returned under the header row, all I get is a count of 1 in row.count. I presume this is related to contiguous ranges within the returned data.
All I need is a way to workout if at least one row was returned by the filter.
Code is below;
I have searched and found a few posts on this and this is what drove me to use the code shown about but it's not working exactly as I need it to. Any ideas?Code:With worksheets("sheet2").Range("Products[#All]") .advancedfilter Action:=xlFilterInPlace, CriteriaRange:=worksheets("sheet4").Range("C1:C" & PCFilterLastRow), Unique:=False ' returned count will always be at least 1 as this is the header so if any data returned then count will be >1 If worksheets("sheet2").Range("Products").Columns(1).SpecialCells(xlCellTypeVisible).Rows.Count > 1 Then Set rng = worksheets("sheet2").Range("Products[PC]").SpecialCells(xlCellTypeVisible) .... do some processing End if end with
Thanks




Reply With Quote