How do I identify range of filtered sheet?
Not too hard.
1. Select Range("A1") (gets you to the top of your data and headers)
2. Selection.End(xlDown).Select (this gets you to the bottom of the list)
3. MyLastRow = Activecell.row
4. Selection.End(xlToRight).Select (this gets you to the last column with
text in it - assuming all columns are filled).
5. MyLastCol = Activecell.column
Now you know your range. Of course, you may want to test your row to see if
it is 65536 - which would indicate that your filters returned zero rows.
"rpw" wrote:
Hello all,
Using Excel 2007. I have a worksheet that I filter and then copy/paste the
results to another worksheet. I have a list of filter criteria and perform a
new filter for each item in the list.
When I apply the first filter, the result is 9 rows - A3:A86. The next
filter I apply will have different results - 5 rows - A17:A345.
My 'stuck point' is programatically identifying the results range
(specifically the row numbers) after the filter is applied. Row 1 is column
headers.
I hope that this is clear enough. Any help is greatly appreciated. Thanks
in advance.
--
rpw
|