View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lou Lou is offline
external usenet poster
 
Posts: 5
Default Macro Loop, Find, and Total

We have a worksheet that can have a varying number of rows.

A B C D E F G H I

1 vvv vvv vvv 23
2 a vvv vvv 34
3 b vvv vvv 34
4 vvv vvv vvv 55
5 a vvv vvv 11
..
..
53 Sub-total 123 444 456 676 333 323
54
55 Gr ttl 2,355

The "vvv's" are variable alphanumberic entries.

We are trying to write a macro that will loop through the
worksheet and pick up a running total of the numbers in
columns D though I for those rows that have either an "a"
or a "b" in column A.

We want to insert a new row under the "Sub-total" row,
name it "CASCA", and enter the running totals by column as
a negative number.
Then we would insert a new "Total" row after that and
enter the sum of the sub-total row and the CASCA row.

A B C D E F G H I

1 vvv vvv vvv 23
2 a vvv vvv 34
3 b vvv vvv 34
4 vvv vvv vvv 55
5 a vvv vvv 11
..
..
53 Sub-total 123 444 456 676 333 323
54 CASCA (68) (11)
55 Total 123 376 456 676 322 323
56
57 Gr ttl 2,276