VBA help for adding rows on a loop until a specified value is reached

jakeecirg

New Member
Joined
Mar 24, 2025
Messages
25
Office Version
  1. 365
Platform
  1. Windows
So i am new to VBA code and would very much appreciate any help that could be given:

In my column "D & F" there are the names of two separate people. The rows underneath contain the age that they are in each year. (Ascending per year). For example in Cell D14 person 1 is 63 & in D15 (symbolizing a year has passed) person 1 is now 64. I am trying to use some VBA code that will loop through my column ranges "D & F" and continue to add rows at the bottom of the columns until both people turn age 90. This is the formula of how I determine the persons age is here: [=INT((B14-INPUTS!$D$9)/365.25)].

I believe this uses some Until / Loop code but I am running into a dead end.
I would be happy to provide any additional information that could help!
 

Attachments

  • Excel help SS.png
    Excel help SS.png
    24.5 KB · Views: 11
It works fantastic!!!

1. In red font above ( above $ - RMD - Tax) is where the cell formula would be applied.
2. The yellow boxes to the side did not pull down the FV formulas of the years before and were blank.
3. The last part would be the Segment period lengths which you already said was next!

Otherwise it worked flawlessly! I really can't say thank you enough for looking at this for me.
 
Upvote 0
It works fantastic!!!

1. In red font above ( above $ - RMD - Tax) is where the cell formula would be applied.
2. The yellow boxes to the side did not pull down the FV formulas of the years before and were blank.
3. The last part would be the Segment period lengths which you already said was next!

Otherwise it worked flawlessly! I really can't say thank you enough for looking at this for me.
Will update, Please delete all rows starting from row 13 downward, then run the code and share the screen shot with data in it. Please note [Select rows + right click delete]
 
Upvote 0
The mini sheet below is after the code was run. After I ran the code, I highlighted certain cells yellow & changed fonts red to reference them. I changed no values.

1. The box that has the red words I typed "( $ above - RMD - Tax) " ... Example. in N14 ... there should be a formula populated that takes the 'value above' minus 'RMD' minus 'tax'

2. The yellow empty boxes have no formulas in them after I ran code, which should have the FV formula of growth. It ran correctly in the previous code.

I hope this made more sense! If not I will try to explain better. Thanks again Sam
 
Upvote 0
Bucket Solver - Copy.xlsm
BCDEFGHIJKLMNOPQRSTUVWXY
12Plan Year (End Date)Plan Year (End Date)AgeTotal Income Annual TaxesIncome Floor GWRRP Income GWRRP Income GWRRP Income $ 60,284.08$ 50,444.90$ 61,091.62$ 50,374.29$ 33,066.33$ 60,738.79
131/1/2026202663636262$51,000$3,192$34,080$-$-$61,5012%$51,4632%$63,5814%$53,4816%$35,8118%$65,7808%
142026 RMD[PLACEHOLDER] RMD Formula"=$ above - RMD - Tax"
152026 Tax[PLACEHOLDER] Tax Formula
161/1/2027202764646363$44,571$2,432$36,166$-$-2%2%4%6%8%8%
172027 RMD[PLACEHOLDER] RMD Formula"=$ above - RMD - Tax"
182027 Tax[PLACEHOLDER] Tax Formula
191/1/2028202865656464$47,299$2,581$38,380$-$-2%2%4%6%8%8%
202028 RMD[PLACEHOLDER] RMD Formula"=$ above - RMD - Tax"
212028 Tax[PLACEHOLDER] Tax Formula
221/1/2029202966666565$50,194$5,019$-$-$-2%2%4%6%8%8%
232029 RMD[PLACEHOLDER] RMD Formula"=$ above - RMD - Tax"
242029 Tax[PLACEHOLDER] Tax Formula
251/1/2030203067676666$53,266$5,327$-$-$-2%2%4%6%8%8%
262030 RMD[PLACEHOLDER] RMD Formula"=$ above - RMD - Tax"
272030 Tax[PLACEHOLDER] Tax Formula
281/1/2031203168686767$56,526$5,653$-$-$-2%2%4%6%8%8%
292031 RMD[PLACEHOLDER] RMD Formula
302031 Tax[PLACEHOLDER] Tax Formula
311/1/2032203269696868$59,986$5,999$-$-$-2%2%4%6%8%8%
322032 RMD[PLACEHOLDER] RMD Formula
332032 Tax[PLACEHOLDER] Tax Formula
341/1/2033203370706969$63,658$6,366$-$-$-2%2%4%6%8%8%
352033 RMD[PLACEHOLDER] RMD Formula
362033 Tax[PLACEHOLDER] Tax Formula
371/1/2034203471717070$67,554$6,755$-$-$-2%2%4%6%8%8%
382034 RMD[PLACEHOLDER] RMD Formula
392034 Tax[PLACEHOLDER] Tax Formula
401/1/2035203572727171$-$-$-$-$-2%2%4%6%8%8%
412035 RMD[PLACEHOLDER] RMD Formula
422035 Tax[PLACEHOLDER] Tax Formula
431/1/2036203673737272$-$-$-$-$-2%2%4%6%8%8%
442036 RMD[PLACEHOLDER] RMD Formula
452036 Tax[PLACEHOLDER] Tax Formula
461/1/2037203774747373$-$-$-$-$-2%2%4%6%8%8%
472037 RMD[PLACEHOLDER] RMD Formula
482037 Tax[PLACEHOLDER] Tax Formula
491/1/2038203875757474$-$-$-$-$-2%2%4%6%8%8%
502038 RMD[PLACEHOLDER] RMD Formula
512038 Tax[PLACEHOLDER] Tax Formula
521/1/2039203976767575$-$-$-$-$-2%2%4%6%8%8%
532039 RMD[PLACEHOLDER] RMD Formula
542039 Tax[PLACEHOLDER] Tax Formula
CHART
Cell Formulas
RangeFormula
N12,X12,V12,T12,R12,P12N12=N9
B13B13=IF(INPUTS!E9>INPUTS!E10,INPUTS!E10,INPUTS!E9)
C13,C52,C49,C46,C43,C40,C37,C34,C31,C28,C25,C22,C19,C16C13=YEAR(B13)
D13,D52,D49,D46,D43,D40,D37,D34,D31,D28,D25,D22,D19,D16D13=INT((B13-INPUTS!$D$9)/365.25)
E13,E52,E49,E46,E43,E40,E37,E34,E31,E28,E25,E22,E19,E16E13=IF(D13>INPUTS!$F$15,0,D13)
F13,F52,F49,F46,F43,F40,F37,F34,F31,F28,F25,F22,F19,F16F13=INT((B13-INPUTS!$D$10)/365.25)
G13,G52,G49,G46,G43,G40,G37,G34,G31,G28,G25,G22,G19,G16G13=IF(F13>INPUTS!$F$20,0,F13)
H13,H52,H49,H46,H43,H40,H37,H34,H31,H28,H25,H22,H19,H16H13=MATH!AH9
I13,I52,I49,I46,I43,I40,I37,I34,I31,I28,I25,I22,I19,I16I13=MATH!AL9
J13,J52,J49,J46,J43,J40,J37,J34,J31,J28,J25,J22,J19,J16J13=MATH!AC9
L13,L52,L49,L46,L43,L40,L37,L34,L31,L28,L25,L22,L19,L16L13=IF(K13<0,0,K13)
M13,M52,M49,M46,M43,M40,M37,M34,M31,M28,M25,M22,M19,M16M13=IF(L13=0,AU13,L13+AU13)
N13N13=-FV(O13/12,12,-L13/12,N12,0)
O13,O52,O49,O46,O43,O40,O37,O34,O31,O28,O25,O22,O19,O16O13=$N$8
P13,R13P13=-FV(Q13/12,12,0,P12,0)
Q13,Q52,Q49,Q46,Q43,Q40,Q37,Q34,Q31,Q28,Q25,Q22,Q19,Q16Q13=$P$7
S13,S52,S49,S46,S43,S40,S37,S34,S31,S28,S25,S22,S19,S16S13=$R$7
T13T13=-FV(U13/12,12,0,T12,1)
U13,U52,U49,U46,U43,U40,U37,U34,U31,U28,U25,U22,U19,U16U13=$T$7
V13V13=-FV($W$13/12,12,0,V12,0)
W13,W52,W49,W46,W43,W40,W37,W34,W31,W28,W25,W22,W19,W16W13=$V$7
X13X13=-FV($Y$13/12,12,0,X12,0)
Y13,Y52,Y49,Y46,Y43,Y40,Y37,Y34,Y31,Y28,Y25,Y22,Y19,Y16Y13=$X$7
B16,B52,B49,B46,B43,B40,B37,B34,B31,B28,B25,B22,B19B16=DATE(YEAR(B13)+1,MONTH(B13),DAY(B13))
 
Upvote 0
In the formula (=$ above - rmd - tax) the values from RMD and TAX are found in the Placeholder formula section. I hope that adds clarity!
 
Upvote 0
Looks good to me Sam. I don't see the RMD and Taxes in the working file but the rest looks good here!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top