Help with dulicate range and highlight rows

R

ryanp

Hi,

My table has data from coluum A to W. I would like to duplicate the data in
coluum A to H. Each new row will be right below the original one. Then the
new rows will be hightlighted from coluum A to W.

I appreciate your help.
 
D

Dave Peterson

Maybe this'll get you started:

Option Explicit
Sub testme01()

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim wks As Worksheet

Set wks = Worksheets("sheet1")

With wks
FirstRow = 2 'headers in row 1?
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = LastRow To FirstRow Step -1
.Rows(iRow + 1).Insert
.Cells(iRow, "A").Range("a1:h1").Copy _
Destination:=.Cells(iRow + 1, "A")
.Cells(iRow + 1, "A").Range("a1:w1").Interior.ColorIndex = 3
Next iRow
End With

End Sub
 
Top