Find, Loop, Subtotal

  • Thread starter Thread starter Adresmith
  • Start date Start date
A

Adresmith

I have a spreadsheet that calculates budgets. The rows that being wit
"52000" are totals. I need VBA that will loop through my spreadshee
and subtotal each column using the values adjacent to the totals. I
anyone can help I would greatly appreciate it!

Thanks, Adrianne

Cost Center Description 2005 Plan 2004 Forecast @ September Close
94200 HUMAN RESOURCES DEPARTMENT $400,636 $410,759
94230 EMPLOYMENT $186,299 $140,289
94250 ORGANIZATIONAL DEVELOPMENT $216,356 $218,593
94400 LABOR RELATIONS $127,307 $114,536
94700 SAFETY $108,942 $25,638
94650 COMPENSATION $135,107 $119,884
94600 TRAINING AND DEVELOPMENT $167,055 $146,795
52000100 STRAIGHT TIME REGULAR $1,341,702 $1,176,494
94400 LABOR RELATIONS $0 $0
52000800 HOLIDAY WORKED PREMIUM $0 $0
94200 HUMAN RESOURCES DEPARTMENT $0 $60
 
If you don't really need VBA, you can do this with SUMIF. Assuming the cost
centers are all numeric,

=SUMIF(A1:A200,">=52000000",C1:C200)

If you need VBA, you should be able to write the same thing there using

Set Rng1 = Range("A1:A200")
Set Rng2 = Rng1.Offset(0, 2)

X = Application.SUMIF(Rng1,">=52000000",Rng2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top