How to define the CellAddress for Write Cell in a For Each Row loop?

Do need help for the last step of my project, any hint is highly appreciated.

Read Range from Gsheets, ForEach row in datatable, after 2 If conditions Then the last step is to Write Cell to indicate the process is finished.

Tried many ways to Assign variable for CellAddress but all got errors…“Invalid Range specified.”

@MubieSam_Lin
If you are trying to write “Ok” Based on row Index .
Then use “A”&DT.rows.index(row)

1 Like

@hemanth_chinna Thanks for the quick reply.
I tried with “F”&dt.Rows.IndexOf(row)
it wrote to the right column “F” but wrong row (should write to row 18, but 16), any idea where I had done wrong?

@MubieSam_Lin
Rowindex from datatable is 0 based
Rowindex from excel is 1 based

You got a difference of 2

Check if there was an add headers involved, so the reason for the difference of 2 is one by dt-excel plus one by add headers

So just correct the range index by +2

1 Like

@ppr yes, you are right, +2 solved the problem.
Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.