Fill New Row

  • Need to fill the newly created rows with a color. The VBA below is what I have set to insert a new row between data that I highlight. Need this row filled. Thank you to anyone that can help


    Sub InsertAlternateRows()

    'This code will insert a row after every row in the selection

    'This code has been created by Matta

    Dim rng As Range

    Dim CountRow As Integer

    Dim i As Integer

    Set rng = Selection

    CountRow = rng.EntireRow.Count


    For i = 1 To CountRow

    ActiveCell.Offset(1, 0).EntireRow.Insert

    Range("C" & ActiveCell.Offset(1, 0).Row).Value = Range("C" & ActiveCell.Offset(0, 0).Row).Value

    ActiveCell.Offset(1, 3).Value = ActiveCell.Offset(-2, 3).Value

    ActiveCell.Offset(1, 4).Value = ActiveCell.Offset(-2, 4).Value

    Range("F" & ActiveCell.Offset(1, 0).Row).Value = Range("F" & ActiveCell.Offset(0, 0).Row).Value

    ActiveCell.Offset(1, 10).Value = ActiveCell.Offset(0, 10).Value

    ActiveCell.Offset(1, 11).Value = ActiveCell.Offset(0, 11).Value

    ActiveCell.Offset(1, 12).Value = ActiveCell.Offset(0, 12).Value

    ActiveCell.Offset(1, 13).Value = ActiveCell.Offset(0, 14).Value

    ActiveCell.Offset(1, 19).Value = ActiveCell.Offset(0, 19).Value

    ActiveCell.Offset(1, 20).Value = ActiveCell.Offset(0, 21).Value

    ActiveCell.Offset(1, 22).Value = ActiveCell.Offset(0, 22).Value

    ActiveCell.Offset(1, 23).Value = ActiveCell.Offset(0, 23).Value

    ActiveCell.Offset(2, 0).Select


    Next i


    End Sub

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post


    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.


    How to use code tags


    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Thanks.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!