In the above screenshot,I want to find the last cell value of column b ,if the value is null or empty then I have to search for the previous cell value of same column b and fetch that value and update to the rest cells of column b .
Please guide me how can I achieve this.
Below is the output screenshot I have attached for reference
For Each row In dt.AsEnumerable()
Dim rowIndex As Integer = dt.Rows.IndexOf(row)
Dim previousValue As String = If(rowIndex > 0, dt.Rows(rowIndex - 1)("ColumnB").ToString(), "")
Dim currentValue As String = row("ColumnB").ToString()
If String.IsNullOrEmpty(currentValue) Then
dt.Rows(rowIndex).SetField("ColumnB", previousValue)
End If
Next
For Each row As DataRow In dtInput.Rows
Dim rowIndex As Integer = dtInput.Rows.IndexOf(row)
If rowIndex > 0 AndAlso String.IsNullOrWhiteSpace(row(7).ToString()) Then
row(7) = dtInput.Rows(rowIndex - 1)(7)
End If
Next