January 14, 2013

How to insert blank row on column change in excel

This is a Macro code in excel to insert blank row on column change in excel.

Dim rval As String, i As Long
rval = Cells(1, 1): i = 2
Do Until Trim(Cells(i, 1) & "") = ""
If Cells(i, 1) <> rval Then
rval = Cells(i, 1)
Rows(i).insert shift:=xlDown
i = i + 1
End If
i = i + 1
Loop
End Sub

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.