Insert blank row

  • Thread starter Thread starter Annette
  • Start date Start date
A

Annette

Does anyone have a macro already written that inserts a blank row above any
date found in a column. I am attempting to insert a blank row above every
date found in column A -- the number of rows will always be different.

Thanks.
 
I think that this one will work.

Option Explicit
Sub testme()

Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim wks As Worksheet

Set wks = ActiveSheet

With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = LastRow To FirstRow Step -1
If IsDate(.Cells(iRow, "A").Value) Then
.Rows(iRow).Insert
End If
Next iRow
End With

End Sub

The last one worked ok--unless there were two dates in consecutive cells.

(Bad testing on my part--sorry.)
 
Back
Top