Add in specific cells
Try the below
Sub Macro()
Dim lngRow As Long, lngLastRow As Long
lngLastRow = Cells(Rows.Count, 2).End(xlUp).Row + 1
For lngRow = lngLastRow To 2 Step -1
If Range("A" & lngRow) < Range("A" & lngRow - 1) Then _
Rows(lngRow).EntireRow.Resize(2).Insert
If Range("A" & lngRow) = "" Then
Range("D" & lngRow) = "text"
Range("E" & lngRow).Formula = "=today()"
End If
Next
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"Seeker" wrote:
Dear volunteers,
I got following script from the discussion group months ago to separate
groups of data with two empty rows base on cells in column A. Now I would
like to add text and formula in column D and E (in every first empty row) at
bottom of each groups, any ideahow can I do that?
Dim lngRow As Long
For lngRow = Cells(Rows.Count, 2).End(xlUp).Row To 2 Step -1
If Range("A" & lngRow) < Range("A" & lngRow - 1) Then
Rows(lngRow).EntireRow.Resize(2).Insert
End If
Next
Regards
|