Inserting 3 new rows after the word total
dd wrote:
Thanks Martin.
I'll test this next week but it seems to work fine for now.
I also rated this 5 stars.
Thanks again.
On Dec 15, 5:03 pm, Martin Fishlock
wrote:
dd, I think this will do your job, assuming the items are in column A.
Sub insert3rows()
Dim i As Integer
Dim rCell As Range
Dim lFirstRow As Long
With ActiveSheet.Range("A:A")
Set rCell = .Find("total", _
LookIn:=xlValues, LookAt:=xlWhole)
If Not rCell Is Nothing Then
lFirstRow = rCell.Row
Do
With rCell.Offset(1, 0)
For i = 1 To 3
.Insert xlShiftDown
Next i
End With
Set rCell = .FindNext(rCell)
Loop While Not rCell Is Nothing And rCell.Row < lFirstRow
End If
End With
End Sub
--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.
"dd" wrote:
Hi, I'm working with multiple rows of data, probably around 3000 rows
and I have the word "total" in between the data in Column A in Excel. I
want to add three blank rows after the word Total. The word Total is
also in bold font. Can someone please help with a macro? Thanks.
|