VBA to filter list for each unique value

Yamezz

Active Member
Joined
Nov 22, 2006
Messages
334
Office Version
  1. 2019
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.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I'm not sure how to attach a workbook, but here's a screenshot.



Thanks.
 
Upvote 0
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?
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top