Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy a range using macro

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Copy a range using macro

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
--
Gary''s Student


"Jen" wrote:

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Copy a range using macro

Hi Jen,

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

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

Regards,
Ingolf


Jen schrieb:

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro copy from range puiuluipui Excel Discussion (Misc queries) 3 October 19th 09 05:03 PM
Set a range in a Macro to copy MikeC[_4_] Excel Programming 1 February 23rd 06 05:22 PM
MACRO TO COPY TO A RANGE asuncionw Excel Discussion (Misc queries) 3 February 9th 06 04:39 PM
Macro to copy a specified range to a variable range SWT Excel Programming 4 October 21st 05 08:24 PM
Macro to copy a range PCOR Excel Programming 4 December 27th 03 03:21 PM


All times are GMT +1. The time now is 04:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"