I have a list of about 12,000 lines, with project numbers, account managers, create date, status... and so on.. Currently I am making reports every 2 weeks, as pivot tables, and then I make graphs out of them. I know that this can be automated, as I eliminated the pivot tables and replicated the result with countifs. Now I want to be able to do the same thing with VBA, to the point where a user can go in a spreadsheet, hit a button and the most current data will portray. To start with this, I want to explore a little bit of countif in vba.
Let's say that the table looks like this
A | B | C
proj.Number Account Manager Status
123 Person 1 Won
234 Person 2 Lost
345 Person 3 Quoted
Currently this is my code, that works fine for countif, but it's without a loop... and I know it can be done somehow
Dim PersonOne as Range
Set PersonOne = Range("E2")
Dim PersonTwo as Range
Set PersonTwo = Range("E3")
Dim PersonThree as Range
Set PersonThree = Range("E4")
Range("D2") = "Person 1"
Range("D3") = "Person 2"
Range("D4") = "Person 3"
PersonOne = (WorksheetFunction.CountIf(Range("B2", Range("B2").End(xlDown)), "Person 1"))
PersonTwo = (WorksheetFunction.CountIf(Range("B2", Range("B2").End(xlDown)), "Person 2"))
PersonThree = (WorksheetFunction.CountIf(Range("B2", Range("B2").End(xlDown)), "Person 3"))
How do I automate this, to the point that I don't even have to write the names of the people (the part where I say range(d2) = some person Can I have a code that looks for all possible unique names, puts them in a certain range of a spreadsheet, and than count how many times that name occurs in the given range?
Thank you