Macro: Inserting a new row, keep the formatting - change fill for one cell

Hi!
Attached I have a macro for inserting a new row into a spreadsheet. This works fine but I would like the macro to preset the cell i column K with a fill color (using RGB value). This fill color will later be changed by a macro running in Worksheet_change.

Thanks!


Sub InsertARow()
     'make new row
    ActiveCell.EntireRow.Insert shift:=xlUp
     'copy the row above
    ActiveCell.Offset(1, 0).EntireRow.Copy Cells(ActiveCell.Row, 1)
    On Error Resume Next
     'clear every cell in the new line that does not have a formula
    ActiveCell.EntireRow.SpecialCells(xlCellTypeConstants, 23).ClearContents
End Sub

Open in new window

cegelandAsked:
Who is Participating?
 
philip m o'brienConnect With a Mentor Commented:
Add this just before the "End Sub":
Cells(ActiveCell.Row, 11).Interior.Color = RGB(200, 160, 35)
and change the RGB value to whatever colour you want to use.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.