Updating Column value with variable

Hi everyone,
I have a datatable dt1 where columns A to K and M are populating correctly.
For Column L, it is based on Column K - Column B.

I did a For Each row to loop through row, taking Column K - Column B to give me a variable called Output where the variable type is Double. I have checked and confirmed that the value of Output for each row is correct.

I am stuck at how to update each row of Column L ("Outstanding Balance) with the corresponding Output value.

I tried
convert.ToDouble(dt1.Rows(row index).Item(“Outstanding Balance”).ToString) but it does not seem to work. E.g. whatever i try result in Column L being 0 for all when that should not be the case.

Please let me know if you have any suggestions on what I can check to populate this. Thank you! Really appreciate it.


Can you share your input and expected output?
And also current workflow, if possible?


Hi! Yes.

This is the step that I do to get Output. I used the message box to print the output for each row and confirm that the amount is correct.

Next, I tried to assign Column L to output, where I did
IICodeSummary.Rows(rowInx_TotalAmt).Item(“Outstanding Balance”) = Output
where IICodeSummary is my datatable name, and rowInx_TotalAmt is the row index of my For Each loop as seen below:

For information, TotalAmt is a string variable which contains the distinct ID numbers in dt1 which is Column A.

My desired end state - Column L should contain the respective Output value that I am calculating.

Hope this clarifies. Please let me know what other information you require.


Did you write back the datatable to your worksheet?
If yes, next can you try to set Breakpoint then check if content of the datatable: IICodeSummary is same what you expect at Locals panel?