Selection.AutoFilter Field / Criteria = criteria sometimes non-existing on worksheet
Hi guys,
I'm working now on a piece of code that is basically choosing criteria in
column A and copying displayed info next to it (column A excluded) to
another place.
(...)
Selection.AutoFilter Field:=1, Criteria1:="myCriteria"
Range("B...").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
(...)
I have 3 questions related to this:
a) how to tell the code that if there are no rows fulfilling the criteria,
it should skip this part and go further?
b) how to specify the row number in "Range("B...").Select" (it's obviously
varying depending on criteria)?
- I could perhaps start in A2 instead of B<volatile_row - that could
be one of the solutions, both for point b) and c)
c) how to avoid the situation where there is only one line related to
criteria and using "Selection.End(xlDown)" will go until 65536?
I'll continue to look for a solution by myself, but if you know the answer,
thanks to let me know...
Thanks and cheers,
Mark
|