Help with dulicate range and highlight rows

  • Thread starter Thread starter ryanp
  • Start date Start date
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top