Paste date values into the next cell

Hi,

I have an scenario where the dates and serial numbers are in a single column.

I have to arrange the dates in a order where serial number should be replaced by the date in the upper cell.

I have tried an if condition logic but my file contains 30000 records. So it is taking too long to complete.

I have attached file for reference

Thanks in advance.
Test.xlsx (226.8 KB)

Hi,

How about using InvokeCode as the following?

image

Dim i As Int32
Dim m = dt.Rows.Count
Dim previous As Object
While(i<m)
If DateTime.TryParse(dt.Rows(i).Item(0).ToString,Nothing) Then

    previous = dt.Rows(i).Item(0)
Else
    dt.Rows(i).Item(0)=previous
End If
i=i+1
End While

Sample
Sample20231007-1aL.zip (176.1 KB)

Regards,

@Rupesh_Parle

Try this in invoke code where dt is to be passed as in/out argument and dt1 the same datatable as only in argument

Dt.AsEnumerable.ToList.ForEach(Sub(r,i) r("sr no") = If(r("sr no").ToString.Contains("/"),r("sr no").ToString,dt1.Rows(i-1)("sr no").ToString))

Hope this helps

Cheers

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