Filtering/Excluding Values
I'm trying to filter values on two columns, then count the number of rows remaining with the result displayed in a pop-up message box, and then exclude values on two columns. So basically, I'm filtering four columns total, but breaking them up into two sections so that I can count the number of rows after the first set of filtering.
This is what I have so far: Code:
It's highlighting this line: "Set rng1 = ActiveSheet.AutoFilter.Range.Rows(1)" I don't understand since it's exactly the same as the first set of code except that the headers have changed (and the exclusion). If someone can help me out, I'd really appreciate it. Also, if you can think of a way to simplify my code, I'm open to suggestions. |
Quote:
Not sure how to delete a thread, but I've solved my own problem. When I was running the code back-to-back while testing it, I didn't reset the autofilter, so it was unfiltering the columns the 2nd time I ran it, and caused the error. Putting this before my filter code did the trick to reset: Code:
Sub AutoFilterOff() |
Filtering/Excluding Values
Hi,
Below is an example of a range object: --- Set r = ws.Range("A1").CurrentRegion With r .AutoFilter 13, "NZzzM", xlAnd Set rv = .Offset(1).SpecialCells(xlCellTypeVisible) End With --- By using 2 objects, it makes object range autofilter methods easier. Pascal Baro |
All times are GMT +1. The time now is 09:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com