Insert Row After Series
This goes through and looks at column A and inserts a row where there are
changes. Hope this helps!
Option Explicit
Sub insertrows()
Dim curselection As Range
Set curselection = Range("A1") 'or wherever you start
Do While curselection < ""
If curselection < curselection.Offset(1, 0) Then
curselection.Offset(1, 0).EntireRow.Insert
Set curselection = curselection.Offset(1, 0)
End If
Set curselection = curselection.Offset(1, 0)
Loop
End Sub
--
-SA
"FrankM" wrote:
I think this is possible but I'm not certain of the way the code would look.
I have an extract that comes to me in Excel format and I have a Macro that
runs through the Excel file reformatting it. The extract will have several
hundred rows.
Column I has a State description (I believe there are a couple dozen
descriptions) and what I need to do is add a blank row after each state.
Example ...
Pending
Pending
Pending
In Process
In Process
Active
Active
Active
would become
Pending
Pending
Pending
In Process
In Process
Active
Active
Active
I guess what I would like would be to add code to the existing Macro that
basically says everytime the value in column I changes add a row. Any ideas.
I hope this makes sense.
|