How to write value in column based on if there is data in another column?

Hi All,

I am trying to write value in column A based if there is a value in column B.
the document will be received in the following format.
column A2 has the vendor number and column B has the invoices from cell B2:dynamic number of cells “each document will have different number of invoices”
the following example is not working and not sure why it is not able to write the value.
StatementReview_PRD_VenNum - Copy.zip (8.1 KB)

Hi @Yan, I made some changes in your example and I believe that it’s working properly right now. Kindly check it please and feel free to add your comments and also check the differences between your example and the one that I have provided.

excel test vendor auto fill.zip (8.3 KB)

2 Likes

Hi @acaciomelo

Thank you for sharing the solution, much appreciated…

I have tried a different approach and it is working as well. what i did is:

1- read range
2- rowcount =datatable.rows.count
3- read the cell that has the vendor number
4- write value, in the range “A2:A”+ rowcount

thank you again :slight_smile:

1 Like