VBA to filter list for each unique value

Yamezz

Board Regular
Joined
Nov 22, 2006
Messages
238
I don't even know where to begin searching for a solution to this, so hopefully someone can point me in the right direction.

I have a bunch of records consisting of a date, an account and a value. Once my code filters the list for the date period I'm interested in, I'd like to then filter the remaining results by account, then transfer that account name and its SUBTOTAL(9,xxx) value to another sheet. How can I get the code to step through each unique account? In one period I may have accounts X, Y, and Z, but another period it may just be X and Z, or A, B and C.

I guess I need something along the lines of:
For each unique value in filtered list
Filter further for unique value #1
Copy unique value #1 and it's SUBTOTAL value to Report sheet
Next unique value

Hopefully that explanation makes sense.
Thanks.
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Yamezz

Board Regular
Joined
Nov 22, 2006
Messages
238
I'm not sure how to attach a workbook, but here's a screenshot.



Thanks.
 

SRIKANTHBENONI

New Member
Joined
Jun 30, 2010
Messages
46
So, if you set filter on date and with the date as "01/09/2014" (Example), you want code to copy the table and paste it in another table? Also, do you want name of the sheet to be anything?
 

Yamezz

Board Regular
Joined
Nov 22, 2006
Messages
238
I need to do something different. I know how to do what you describe, but what I want to do is filter for a date period (say August 1st to 20th), then see what accounts were present in that time period, filter for each one of the accounts and finally copy the sum of each account for each time period with the Subtotal(9, function.

Thanks.
 

Watch MrExcel Video

Forum statistics

Threads
1,112,993
Messages
5,543,177
Members
410,583
Latest member
jgalin
Top