I am writing my first major VBA function after writing many small ones. It's a big retirement program that updates a retirement fund monthly and runs for, like, 50 years. Every year, I want to print to the active worksheet the accumulated results for expenditures, income, change in fund, etc., writing 13 variables on one line. I debug the program by stepping it through and watching the "local" variables take/change, and I know they have the correct value. But, when I try to write to the active sheet, it writes the first cell (roww, 5) but bombs out on trying the second write. Here's a slice of the code, where
roww is Dim as integer and computed,
k is Dim as integer and is the year-counter,
StartYear for debugging is Dim as integer, and
cum_work_income is Dim as Currency, and I see it has the correct value:
Cells(roww, 5).Value = StartYear + k
Cells(roww, 6).Value = cum_work_income
Cells(roww, 7).Value = cum_ret_income
Cells(roww, 8).Value = cum_addl_income
Any thoughts would be deeply appreciated!!
Thanks, Lancish
roww is Dim as integer and computed,
k is Dim as integer and is the year-counter,
StartYear for debugging is Dim as integer, and
cum_work_income is Dim as Currency, and I see it has the correct value:
Cells(roww, 5).Value = StartYear + k
Cells(roww, 6).Value = cum_work_income
Cells(roww, 7).Value = cum_ret_income
Cells(roww, 8).Value = cum_addl_income
Any thoughts would be deeply appreciated!!
Thanks, Lancish