Copy a range using macro

J

Jen

hi, i am a new learner in microsoft excel macro.

Row Dept Module Headcount access number
1 AT 5 23 5
2
3 BA 2 10 5
4
5 FG 7 12 5


Based on the example above, I need help on how to copy row 1 to 2, row
3 to 4 and row 5 to 6 using "range" command? Thank you.
 
G

Guest

Sub gsnu()

Set r = ActiveSheet.UsedRange
nlastrow = r.Rows.Count + r.Row - 1

For i = 1 To nlastrow Step 2
Cells(i, 1).EntireRow.Copy Cells(i + 1, 1)
Next

End Sub
 
I

Ingolf

Hi Jen,

the following command will copy the entire row 1 to row 2:

Range("1:1").Copy Destination:=Range("2:2")

Regards,
Ingolf
 

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

Top