May 04 2023 07:08 AM
Hi,
I want to insert a row between data that is a set date.
I.e i want to inset a row underneath all data relating to 01/05 and then a row underneath all date relating to 02/05 etc
Thank you in advance
May 04 2023 07:35 AM
Run the following macro, but before you do that, change the values of the constants fr and c as needed.
Sub InsertRows()
Const fr = 2 ' First row with data
Const c = "D" ' Columm with dates
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
m = Cells(Rows.Count, c).End(xlUp).Row
For r = m To fr + 1 Step -1
If Cells(r, c).Value <> Cells(r - 1, c).Value Then
Cells(r, c).EntireRow.Insert
End If
Next r
Application.ScreenUpdating = True
End Sub