Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Macro Loop, Find, and Total

Hi
doesit has to be a macro?. As SUMPRODUCT should handle
(most) of your requirements.
e.g.
=SUMPRODUCT((A1:A100="a")*(D1:I100))

-----Original Message-----
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

.

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

Frank, I think that it does need to be a macro. We have a
rather large macro that imports a text file, sorts data
into various worksheeets and performs some other routines
for the users.

This would be a module that is a part of the larger macro
and we are trying to accomplish the activity described
below. The number of rows can be 10 or 600 and it seems to
me that we need a macro to be able to accomplish the
outcomes we want. The large macro runs so that the end
user only has to enter "ctrl-r" and everything happens
automatically.

-----Original Message-----
Hi
doesit has to be a macro?. As SUMPRODUCT should handle
(most) of your requirements.
e.g.
=SUMPRODUCT((A1:A100="a")*(D1:I100))

-----Original Message-----
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

.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop or Find code ?? need help !! EBnLP01 Excel Worksheet Functions 4 October 29th 09 05:47 PM
Find loop doesn't loop JSnow Excel Discussion (Misc queries) 2 June 24th 09 08:28 PM
Find & loop in VBA Noemi Excel Discussion (Misc queries) 3 January 25th 06 03:39 AM
Find loop Jamie[_8_] Excel Programming 2 April 22nd 04 10:00 PM
Find value loop not working Christiane[_6_] Excel Programming 3 April 6th 04 01:53 AM


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"