+ Reply to Thread
Results 1 to 5 of 5

Copy range several times less first row

Hybrid View

markos97 Copy range several times less... 06-28-2010, 03:32 AM
pike Re: Copy range several times... 06-28-2010, 05:57 AM
markos97 Re: Copy range several times... 06-28-2010, 06:44 AM
pike Re: Copy range several times... 06-28-2010, 06:54 AM
markos97 Re: Copy range several times... 07-28-2010, 08:54 AM
  1. #1
    Registered User
    Join Date
    06-28-2010
    Location
    Posen, Poland
    MS-Off Ver
    Excel 2000
    Posts
    46

    Copy range several times less first row

    Hi!
    I hope so, I choose a good forum with: Excel genral/miscellaneous/programming.
    My problem is: I want to copy n times, a range, for example range ("G1:H5") like this:
    --A-B-C-D-E-F-G-H
    1--------------------e--f
    2--------------x-o--x-o
    3-------c--r--c-r---c--r
    4-------e-u--e-u---e-u
    5-------l-m--l-m---l-m
    Now, I'm using below code:
    Sub copysteps()
        For i = 1 To 2 ‘two copies, make change
            Selection.Resize(Selection.Rows.Count - 1).Copy
            ActiveCell.Offset(0, -2).Select  
            ActiveSheet.Paste
        Next i
    End Sub
    but after use this code, the data looks like that:
    --A-B-C-D-E-F-G-H
    1-------e--f--e--f--e--f
    2-------x--o-x--o--x-o
    3-------c--r--c--r--c--r
    4--------------e--u-e--u
    5---------------------l--m
    Can you help me modify this code? Thanks.
    Regards
    Last edited by markos97; 06-28-2010 at 03:35 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copy range several times less first row

    Hi markos97
    Welcome to the forum

    Try this code
    Sub copysteps()
        For i = 1 To 2 'two copies, make change
            Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Copy
            ActiveCell.Offset(1, -2).Select
            ActiveSheet.Paste
        Next i
    End Sub
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    06-28-2010
    Location
    Posen, Poland
    MS-Off Ver
    Excel 2000
    Posts
    46

    Re: Copy range several times less first row

    Hi!
    Thanks for your repley! Your code is so good, but not yet good enough. I think you write it from memory, and you don't try to run this code. But, never mind.
    That's beforee I see, you help me, I find this: http://support.microsoft.com/kb/148462
    Then I thinking about it, very intensively, and even though I manage to get:
    Sub steps() 
    For i = 1 To 2  'two copies, make change
    Selection.Offset(1, 0).Resize(Selection.Rows.Count, 2).Copy  'one cell down select 
    ActiveCell.Offset(1, -2).Select  'one cell down copy, and 2 cells left destination
            ActiveSheet.Paste
         Next i
    End Sub
    Once more time, I would like to thank you for your help. Finally, sorry for my english.
    Regards

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copy range several times less first row

    Hi markos97
    not to sure if it is what you require or not. I'm also sorry as I only speek english (poorly).

  5. #5
    Registered User
    Join Date
    06-28-2010
    Location
    Posen, Poland
    MS-Off Ver
    Excel 2000
    Posts
    46

    Re: Copy range several times less first row

    Hi!
    Yes, you're right pike. Sorry, very sorry, your code working good also as my code. I'm something mistake. Maybe I damage a file, or something that.
    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1