Hello. I have the code below that inserts a blank row when the value in the selected column changes. It works great except that it inserts a blank row at row 2 because of the header. I am having a brain fart and not seeing how to exclude the header in the logic. Any help is appreciated.
VBA Code:
Public Sub InsertRowsAtChange(Control As IRibbonControl)
Dim rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Separate Changed Values"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
For i = WorkRng.Rows.Count To 2 Step -1
If WorkRng.Cells(i, 1).Value <> WorkRng.Cells(i - 1, 1).Value Then
WorkRng.Cells(i, 1).EntireRow.Insert
End If
Next
Application.ScreenUpdating = True
End Sub