View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default Auto insert of blank row depending on data

Hi

try

Sub Insert2Rows()
Dim c As Long, lrow As Long
With ActiveSheet
lrow = .Cells(.Rows.Count, "A").End(xlUp).Row

For c = lrow - 1 To 1 Step -1
If .Cells(c, 1).Value < "" Then
If .Cells(c, "A").Value < .Cells(c + 1, "A").Value Then
.Cells(c + 1, "A").Resize(2).EntireRow.Insert
End If
End If

Next
End With

End Sub

--

Regards
Roger Govier

wrote in message
...
I'm trying to get myself a macro so I can analyse my data but after
running it a couple of times (and changing info) the results don't
come out as planned. Basically what I'm trying to do is get it to
insert two blank rows when a change in data happens. For example:

1
1
1
1
2
2
2

It should insert two blank rows between the 1 and 2. The problem is
that the data is not in sequence and sometimes is not a number. I need
it to recognise a change regardless of what the value is. Any help/
code would be appreciated