Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Excel macro to insert blank rows at a ever-changing interval

I have a list of names, addresses, and phone numbers all located in column A.
I need to insert a blank row after each phone number (which is formatted as
bold and in the style of (###) ###-####. Can someone help me on this. I
have a macro to make user-friendly after this point, but I can't seem to get
the row to insert. Please note that the grouping may vary from Company to
Company (2, 3, 4, or 5 lines of info), so I can't use a constant value.

Using Excel 2003 on Windows Server 2003. Thanks!

-Aaron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Excel macro to insert blank rows at a ever-changing interval

Hi,

Try this which looks for "(" and then insrts line after.

Sub a()
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
With Worksheets("Sheets1").Range("a1:a" & lastrow) <=== Change as needed
Set c = .Find("(", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Offset(1, 0).EntireRow.Insert
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub

HTH

"KnightRiderAW" wrote:

I have a list of names, addresses, and phone numbers all located in column A.
I need to insert a blank row after each phone number (which is formatted as
bold and in the style of (###) ###-####. Can someone help me on this. I
have a macro to make user-friendly after this point, but I can't seem to get
the row to insert. Please note that the grouping may vary from Company to
Company (2, 3, 4, or 5 lines of info), so I can't use a constant value.

Using Excel 2003 on Windows Server 2003. Thanks!

-Aaron

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
Excel 2002: Any button to insert blank rows at specific interval? Mr. Low Excel Discussion (Misc queries) 5 March 29th 09 02:51 PM
Macro to copy previous row and insert two blank rows dd Excel Discussion (Misc queries) 1 April 30th 07 11:25 PM
How can I insert a blank row after every four rows in Excel? EmmaSB Excel Discussion (Misc queries) 2 April 20th 07 10:10 PM
How do I create a Macro to sort data and insert blank rows & subto karinmpfa Excel Worksheet Functions 2 April 25th 06 09:57 PM
Activate a macro to insert a row and copy the formuals from the rows above to the blank row oil_driller Excel Discussion (Misc queries) 1 February 11th 05 03:30 PM


All times are GMT +1. The time now is 06:26 PM.

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

About Us

"It's about Microsoft Excel"