I’m working on a data table manipulation, where I’m trying to copy paste the data from previous row in the empty rows until a values comes up.

In row1 I have value ISA001 and next 5 rows are empty, the empty rows needed to be filled with the row1 data. And in row 7 I have value ISA002 and next few rows are empty and needed to be filled with row11 data and so on., I’m attaching a screenshot for reference.

I’m actually manipulating the data table and not excel. The solution for my issues is as follows:

I’m looping through the datatable and inside for each row for data table I’m took IF block.

The condition for IF is currentrow.item(“Segment”).tostring.trim = “” Then currentrow.(“Segment”) = dt.(idx-1)(“Segment”).tostring

where dt is the datatable that i’m looping and i’m taking the index of the for each row in datatable and getting the value of previous cell by subtracting the index by 1.