I want the new line to transfer the data from the cells below for columns A to c and E to L. I have the code below to add a line for each missing date and then update column D with the missing date.
Currently, I end up with a worksheet like this:
The VBA code is:
Dim wks As Worksheet
Set wks = Worksheets("NAV_REPORT")
Dim lastRow As Long
lastRow = Range("D2").End(xlDown).Row
For i = lastRow To 2 Step -1
curcell = wks.Cells(i, 4).Value
prevcell = wks.Cells(i - 1, 4).Value
Do Until curcell - 1 <= prevcell
wks.Rows(i).Insert xlShiftDown
curcell = wks.Cells(i + 1, 4) - 1
wks.Cells(i, 4).Value = curcell
Loop
Next i
Can someone help me in updating the above code to fill up the cells below?