Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2006

Tip: Looking for answers? Try searching our database.

Inserting 3 new rows after the word total

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dd - 16 Dec 2006 00:02 GMT
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.
Bob Phillips - 16 Dec 2006 00:38 GMT
see response in public.excel

Signature

---
HTH

Bob

(change the xxxx to gmail if mailing direct)

> 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.
Martin Fishlock - 16 Dec 2006 01:03 GMT
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

Signature

Hope this helps
Martin Fishlock
Please do not forget to rate this reply.

> 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.
dd - 16 Dec 2006 21:48 GMT
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
<martin_fishl...@yahoo.co.uk.cutthis> wrote:
> dd, I think this will do your job, assuming the items are in column A.
>
[quoted text clipped - 31 lines]
> > 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.
dick@privica.com - 17 Dec 2006 13:07 GMT
> Thanks Martin.
> I'll test this next week but it seems to work fine for now.
[quoted text clipped - 38 lines]
> > > 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.
dick@privica.com - 17 Dec 2006 13:21 GMT
I found this solution helpful but have been trying to conditionally
format a worksheet based on values in different cells.
The thing I haven't been able to do is insert a row above cells of a
given value without getting into a long/infinite loop.
A solution similar to the one below but inserting above the cell would
be brilliant - can anyone help pls.

> Thanks Martin.
> I'll test this next week but it seems to work fine for now.
[quoted text clipped - 38 lines]
> > > 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.
dd - 18 Dec 2006 19:53 GMT
Hi,
I test this today and it did not work on my data. Probably because I
used the Data->Subtotal function in Excel to get the total. This macro
did not insert any rows. But when I opened a new worksheet and manually
typed in a few rows of data in Col A with the word total, it did insert
3 new rows after total. How would I insert 3 new rows after using the
Subtotal function? Thanks

On Dec 15, 5:03 pm, Martin Fishlock
<martin_fishl...@yahoo.co.uk.cutthis> wrote:
> dd, I think this will do your job, assuming the items are in column A.
>
[quoted text clipped - 31 lines]
> > 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.- Hide quoted text -- Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.