I have an excel sheet, which contains 3 columns ‘code’, ‘amount’, ‘doc no’ i used for each row to fetch all the data belongs to “1599” ? pasted in application
During second iteration i need to pick up second code “1288”? How to pick the second code “1288” related data ? Unfortunately bot is taking again “1299” data again
Thanks in advance
Maybe you can try to do it in one loop. Just use extra variable strCode. Default would be “”.
Start the loop with the if statement:
strCode = row(“code”)
If yes, take the values.
If not, assigne new code value to strCode and take the first value.
I hope it help.
I have a similar scenario,
in my process I used a macro in excel sheet that fills in the empty fields with the data from the cell above:
.SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
Probably a LINQ command could be used instead of a macro. In my case, I couldn’t do that, so I don’t have a ready LINQ solution for it.
How to add/update code value dynamically everytime?
Hey, since you are already using for each row, easy option would be adding simple if in the middle to check for the value of current row, and only execute on non empty ones?
If you want to limit loops going though empty rows, linq query to filter out dt to only rows with value in column one would also solve this, but hopefully this is enough.