Writing In Cell That Changes

Hello everyone,

I am having a problem with writing in a cell that is constantly changing. My excel template constantly changes because it is based on different customers invoices, some having more invoices than others but originally where I want to write is located at row 37 (image attached). Would there be a way of keeping track of what the last row is BUT not writing in that cell until the iterations are complete since it won’t always be located at 37

? Thank you.

Hi Kodm,

You can get the last row index for each iterations by [datatable].Rows.Counts. And then write cell by “A” + last_row


image

2 Likes

Hi Tiffany, thank you I used that command however there is still a problem since it shows the last row every iteration. So for example if there are 50 rows itll print 36,37,38… but I just need it to print the final row it creates which would be 50. Count

@tiffany.qy.wu

You can run it until the iterations are complete

Hi @tiffany.qy.wu hank you however it is a bit tricky because the program is constantly creating invoice excel files (fileName + “.xls”) based on the customer so the read range always changes. Would there be a way of keeping track of each individual excel file and maybe setting a boolean for when it completes looping for a specific customer so it doesnt continue counting for a different customer? Thank you. Range

hi Kodm,

I think you can store the last row index for each iteration. If the last index is same as the previous one, then it means completed.

Thank you very much @tiffany.qy.wu. I will give this a try and keep you posted.