Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Add 5 blank rows after Word

How do I insert 5 blanks after the word Books has been used.

I have about 6000 rows in my spreadsheet and there was supposed to be a
total cost. In col A there are lots of blank rows except where words such as
"Books" or "Total Books" or sometimes "Text Books" appear.

Where the word "Book" appears, I would like to add 5 rows below that word.
Thank you.

--Elaine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Add 5 blank rows after Word

Try this for column A

Sub test2()
Dim Rng As Range
Dim findstring As String
findstring = "Books"
Set Rng = Range("A:A").Find(What:=findstring, After:=Range("A" & Rows.Count), _
LookAt:=xlPart)
While Not Rng Is Nothing
Rng.Offset(1, 0).Resize(5, 1).EntireRow.Insert
Set Rng = Range("A" & Rng.Row + 1 & ":A" & Rows.Count) _
.Find(What:=findstring, After:=Range("A" & Rows.Count), _
LookAt:=xlPart)
Wend
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Elaine" wrote in message ...
How do I insert 5 blanks after the word Books has been used.

I have about 6000 rows in my spreadsheet and there was supposed to be a
total cost. In col A there are lots of blank rows except where words such as
"Books" or "Total Books" or sometimes "Text Books" appear.

Where the word "Book" appears, I would like to add 5 rows below that word.
Thank you.

--Elaine



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete blank rows (rows alternate data, blank, data, etc ncochrax Excel Discussion (Misc queries) 2 June 27th 07 04:40 AM
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
how to add word to the front of every word in all rows automatica. Jasmine Excel Discussion (Misc queries) 8 October 10th 05 05:28 PM
Delete blank row only if 2 consecutive blank rows Amy Excel Programming 2 October 21st 04 05:24 PM
Copying and pasting a worksheet to a blank and removing blank rows Bob Reynolds[_3_] Excel Programming 0 June 24th 04 02:55 PM


All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"