View Single Post
  #2   Report Post  
vezerid
 
Posts: n/a
Default how do I insert a blank row when a value changes, automatically

The following VBA procedure should do your work.

Sub InsertRows()

StartRow = 2 'Change the 2 to the row actual data start
DataColumn = 1 'Change the 1 to the column where your data is

i = StartRow + 1
While Cells(i, DataColumn) < ""
If Cells(i, DataColumn) < Cells(i - 1, DataColumn) Then
Cells(i, DataColumn).EntireRow.Insert
i = i + 1
End If
i = i + 1
Wend
End Sub

To run it:
Alt+F11 for the VB editor
menu command Insert | Module
Paste the code
From Excel: Alt+F8


HTH
Kostis Vezerides