LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Find the nearest point to 1000 rows where "amounts" balance and apply special formatting to that row

Set a variable to hold the latest row number where the cumulative sum adds
to zero. So each time the cumulative sum hits zero, set this variable to
that row. Then when you get the the 1000th row, write rows 1 through the
number of the row held in that variable. Then adjust your row counter to
account for the rows not written.

--
Regards,
Tom Ogilvy

"Paul" <paulm dot c @ iol dot ie wrote in message
...
Hi,

I'm writing a macro to create a csv file from a spreadsheet that has to be
formatted in a certain way.

One rule for the csv I'm getting stuck on is as follows:

The speadsheet could contain say 20000 lines. The fields could be Journal
number, description, Amount.

As I extract each row, the code should find the nearest row to 1000 where
the amounts evaluate to zero (the amounts are pluses and minuses) at which
point I can apply specific fomating to that row in the csv extract then to
start the count again from 1 and find the next nearest row to 1000 and

again
apply the specific formatting to that row in the csv extract.

I'm thinking that I could step through each row and add the amounts

(amount
= amount + amount) but the problem is the formatting should occur at the
NEAREST point to 1000 rows as possible. How do I get the code to count

back
from 1000 to find that point if when I'm adding the amounts I'm starting
from 1 and counting up.

Any advise appreciated

Paul






 
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
Conditional Formatting - find cells containg "+" Colin Hayes Excel Discussion (Misc queries) 3 March 19th 10 03:26 PM
Find formatting doesn't work: "Excel cannot find data" Kasama Excel Discussion (Misc queries) 1 August 18th 06 01:40 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
programmaticaly test more then 1000 excel files for "opening Errors" Robert[_28_] Excel Programming 2 December 23rd 04 10:49 PM


All times are GMT +1. The time now is 11:21 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"