I'm doing repeated searches and copying of rows from an excel sheet based upon an index symbol. The data set isn't very large, but because of they nature of the data set the index symbols are not unique overall, but only within a subset of the whole data set. So, I decided to use AutoFilter on the data set to reduce the set down to the appropriate subset for each search. The problem seems to be that autofilter doesn't actually limit the data set for my searches, but only visually.
I determined this by recording the last row for each data set (presumed subset) after filtering and before searching.
With lcr.Range("B1")
.AutoFilter , field:=2, Criteria1:=A, VisibleDropDown:=True
.AutoFilter , field:=3, Criteria1:=B, VisibleDropDown:=True
.AutoFilter , field:=4, Criteria1:=C, VisibleDropDown:=True
End With
r = lcr.Cells(lcr.Rows.Count, "A").End(xlUp).Rows
Debug.Print r
but, the last row (r) always returns the value for the whole data set, and the results reflect that. What am I missing here? How do I temporarily reduce the data set to a specific subset if not by filtering?
Thanks!