I am stuck on this problem and I just cannot get my head around it.
I have a column (column A) with a list of dates, in date order ascending.
How can I insert the missing dates using a for-next loop in VBA please - I need to add a new row for each new date as other columns have data in them?
So, I need to add 02/02/18, 03/02/18, 04/02/18 etc, etc.
This is the code that I have got, but it gets stuck in a loop and basically doesn't work![/SIZE]
Sub correctsomedates() Sheets("BALANCES3").Select lastrow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row For a = lastrow To 12 Step -1 firstDate = Cells(a, 1).Value secondDate = Cells(a - 1, 1).Value If firstDate - 1 <> secondDate Then 'insert new row Range(a - 1 & ":" & a - 1).Select Selection.Insert Range(a - 1 & ":" & a - 1).Select Cells(a - 1, 1).Value = firstDate - 1 a = a + 1 End If Next a End Sub