View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dean[_8_] Dean[_8_] is offline
external usenet poster
 
Posts: 407
Default Need help with a Macro Procedure

I looked up findnext but I just don't understand the syntax enough to work
through it.

I'm sorry that my explanation wasn't good enough for someone to try writing
the code. In the last e-mail, all I was saying is that I had realized that
there are two possible conditions, not just one, which would cause the
algorithm to go back to the prior increment of 10 and accept that (and then
move on to J+1). I hope that it was just that part that confused you.

If it is easier, I can create a new column in excel that, in each row J,
will compute how many rows there are between J and K, rather than making VBA
look down to find the next entry that is greater than 10,000. If it's
easier, just tell me to create such a column, and the macro can use its
result to decide how far to look ahead in the other column, rather than
trying to figure that out itself.

Please ask for any clarification.

Thanks, Don!
Dean

"Don Guillett" wrote in message
...
I'm confused. It seems that your procedure could be more efficient but
have a look in the vba help index for FINDNEXT. There is a good example.
You can nest them.

--
Don Guillett
SalesAid Software

"Dean" wrote in message
...
<< Occasionally, before this condition is met, another increment of 10
causes
the entry in row J of column C to exceed 999,999. If so, then I want to
back off to the prior increment of 10 and end the procedure for the Jth
row


Also, it needs to look at the Jth row in column BB (you can assume it's
called column D)
and if it is greater than 0.1, it should back off to the prior iteration
then too.

"Dean" wrote in message
...
I was wondering if anyone could help me with creating a macro procedure
to do the following, which is a pain to do manually, and needs to be
redone every time anyone changes anything in my spreadsheet, which if
often! I think I've learned enough so that I can troubleshoot the code,
should there be any problem, if someone can supply it to me. By the way,
the columns are really, AU, BH, and AV but I thought it would be easier
to ask for A, C, and B below, and edit that myself. Please let me know
if I have left anything out.



From rows 82 to 164, inclusive, I want to check Column A, one row at a
time (each row is one month later). If the entry is <= 10,000, then
there is nothing needed, so I want the cursor to simply move down to the
next entry in that column. If, in the Jth row, the entry is 10,000,
then it needs to do a test. It needs to look forward to the next row in
this same column A where there is another entry greater than 10,000 -
let's call it the Kth row (K <= 165, at some point, there will be no
such 'future' value greater than 10,000, so then set K = 165). If the
sum of entries in another column, column C, from row 82 until (and
including) this 'future' row K is zero, then, once again, no action is
required and we should just move down one row (to J+1) in column A.



However, if the above test fails to produce zero, then I want to slide
the cursor sideways over to the Jth row of column B and enter the value
10, then repeatedly increment by 10 more, until the second condition
above is met. Occasionally, before this condition is met, another
increment of 10 causes the entry in row J of column C to exceed 999,999.
If so, then I want to back off to the prior increment of 10 and end the
procedure for the Jth row.



Then, go back to column A and continue with the J+1st row, ending at row
164.



Thanks so much!

Dean