I currently have a macro which inserts a row whenever the data in column A changes. What I want to add is that it also shades and autosums columns E throught to I as well.
Could somebody please help me with this?
Here is the code that I am using to insert a row when the data in column A changes
Sub InsRowsWhenCellDataChangesColA()
Dim r As Long, mcol As String, i As Long
' find last used cell in Column A
r = Cells(Rows.Count, "A").End(xlUp).Row
' get value of last used cell in column A
mcol = Cells(r, 1).Value
' insert rows by looping from bottom
For i = r To 2 Step -1
If Cells(i, 1).Value <> mcol Then
mcol = Cells(i, 1).Value
Rows(i + 1).Insert
End If
Next i
End Sub
I have attached the sample data before any changes and the preferred output that I would like to achieve.
Bookmarks