Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2002: Any button to insert blank rows at specific interval? | Excel Discussion (Misc queries) | |||
Macro to copy previous row and insert two blank rows | Excel Discussion (Misc queries) | |||
How can I insert a blank row after every four rows in Excel? | Excel Discussion (Misc queries) | |||
How do I create a Macro to sort data and insert blank rows & subto | Excel Worksheet Functions | |||
Activate a macro to insert a row and copy the formuals from the rows above to the blank row | Excel Discussion (Misc queries) |