B
Bob Sandor
Hi everyone,
I have a spreadsheet which has about 16000 rows. I have a sheet
entitled "Raw Data", and in the first column, "ID", contains an
identifier that is not unique. Meaning, there are many Identifiers,
and they show up multiple times each. Row 1 is a header row. For
example:
A B
----- -----------------------
ID Data
1 blah
1 more blah
2 blah
2 blah
3 even more blah
3 blah blah
3 blah
5 blah, blah, infinity!
.... and so on, and so on.
My end goal is to be able to filter the sheet with an "inclusion"
list. I want to be able to say, "keep ID 1, 3, and 5 and filter out
all the rest." I have a macro which does this with brute force, going
line by line and deleting rows that don't belong. After hunting for a
faster solution I found Advancedfilter. I can't seem to get it to work
though.
I've now added a sheet to my workbook called "Filter", and in that I
created a list and named it "AppFilter". No header row. For example:
A
-----
1
3
5
Here's a code snippet from my sub:
' This is my range containing all the rows and columns of raw data
Set myRange = Sheets("Raw Data").Range(Cells(1, 1), _
Cells(LastCell.row, LastCell.Column))
' Attempting to filter my range
myRange.AdvancedFilter xlFilterInPlace, _
Sheets("Filter").Range("AppFilter"), _
False
When I run my code, nothing seems to happen. My screen blinks and the
macro finishes running, but no filtering occurs. I recieve no errors,
and stepping through the code doesn't seem to help at all. Do I have a
misunderstanding of how this function works.
Any ideas?
- Bob
I have a spreadsheet which has about 16000 rows. I have a sheet
entitled "Raw Data", and in the first column, "ID", contains an
identifier that is not unique. Meaning, there are many Identifiers,
and they show up multiple times each. Row 1 is a header row. For
example:
A B
----- -----------------------
ID Data
1 blah
1 more blah
2 blah
2 blah
3 even more blah
3 blah blah
3 blah
5 blah, blah, infinity!
.... and so on, and so on.
My end goal is to be able to filter the sheet with an "inclusion"
list. I want to be able to say, "keep ID 1, 3, and 5 and filter out
all the rest." I have a macro which does this with brute force, going
line by line and deleting rows that don't belong. After hunting for a
faster solution I found Advancedfilter. I can't seem to get it to work
though.
I've now added a sheet to my workbook called "Filter", and in that I
created a list and named it "AppFilter". No header row. For example:
A
-----
1
3
5
Here's a code snippet from my sub:
' This is my range containing all the rows and columns of raw data
Set myRange = Sheets("Raw Data").Range(Cells(1, 1), _
Cells(LastCell.row, LastCell.Column))
' Attempting to filter my range
myRange.AdvancedFilter xlFilterInPlace, _
Sheets("Filter").Range("AppFilter"), _
False
When I run my code, nothing seems to happen. My screen blinks and the
macro finishes running, but no filtering occurs. I recieve no errors,
and stepping through the code doesn't seem to help at all. Do I have a
misunderstanding of how this function works.
Any ideas?
- Bob