View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Find, Loop, Subtotal

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)

On Fri, 29 Oct 2004 15:23:44 -0500, Adresmith
wrote:


I have a spreadsheet that calculates budgets. The rows that being with
"52000" are totals. I need VBA that will loop through my spreadsheet
and subtotal each column using the values adjacent to the totals. If
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 $608