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 |
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 |
All times are GMT +1. The time now is 09:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com