Forum Discussion
himanshujoshi2211
Nov 02, 2024Copper Contributor
blank row in dates
i want blank row between different dates, and dates are adjusted in column. example if first date is 20-4-2024 second date is again 20-4-2024 but third date is 25-4-2024, third date is different then...
HansVogelaar
Nov 02, 2024MVP
That requires a VBA macro, which will work in the desktop version of Excel for Windows and Mac.
Let's say the dates are in column D, starting in D2.
Sub InsertRows()
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
m = Range("D" & Rows.Count).End(xlUp).Row
For r = m To 3 Step -1
If Range("D" & r - 1).Value <> "" And Range("D" & r).Value <> "" And _
Range("D" & r).Value <> Range("D" & r - 1).Value Then
Range("D" & r).EntireRow.Insert
End If
Next r
Application.ScreenUpdating = True
End Sub
Save the workbook as a macro-enabled workbook (*.xlsm) and make sure that you allow macros when you open it.