VB Loop

abwc066
09-05-2011, 02:54 AM
Hi, I have used macro's before and usually build them by copy from other already written code and then changing the references just to give you an indication of my skill level.

I have a document (About 45,000 lines). Each line is a deal and a client can have several deals. My accounting system calculates an interest value automatically for each deal for the month. The prior month interest is then added to arrive at a year to date interest number. The YTD interest number cannot be larger than the impairment on the deal. If it is, the amount the interest exceeds the impairment needs to be reallocated to the following deal of the client if there is one, and then the process restarts. If there are not additional deals that the interest can be allocated to the the interest is not allocated further. The goals is to arrive at a an amended value for the monthly interest which incorporates the above. I know I should be able to do a loop to do this where the loop will firstly check if the YTD interest exceeds the impairment on a deal, and if it does, decrease the monthly number and the allocates the change to the following deal (Assuming the client has additional deals) and then the loop checks the next one on the list and continues in this vein until complete.

Any help would be much appreciated.

Thanks so much

Werner

Bob Phillips
09-05-2011, 03:07 AM
Cross-posted at ExcelForum http://www.excelforum.com/excel-programming/790978-vb-loop-help-please.html

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum