D
Dean
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
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