+ Reply to Thread
Results 1 to 6 of 6

Macro to more efficiently copy/paste every 21 rows

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    OKC, Ok
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro to more efficiently copy/paste every 21 rows

    Hi everyone, I have recorded the following macro below and it works for what i need it to do but I am looking to learn how to better write macros and the code on this macro where i am copying every 21 rows the same data, I suspect could be done more efficiently with a loop or some other method. Could someone show me the best way to make this macro more efficient so I could learn from it? Thanks.


    Application.Calculation = xlManual

    Range("C10:AU30").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("C31").Select
    ActiveSheet.Paste

    Range("C52").Select
    ActiveSheet.Paste

    Range("C73").Select
    ActiveSheet.Paste

    Range("C94").Select
    ActiveSheet.Paste

    Range("C115").Select
    ActiveSheet.Paste

    Range("C136").Select
    ActiveSheet.Paste

    Range("C157").Select
    ActiveSheet.Paste

    Range("C178").Select
    ActiveSheet.Paste

    Range("C199").Select
    ActiveSheet.Paste

    Range("C220").Select
    ActiveSheet.Paste

    Range("C241").Select
    ActiveSheet.Paste

    Range("C262").Select
    ActiveSheet.Paste

    Range("C283").Select
    ActiveSheet.Paste

    Range("C304").Select
    ActiveSheet.Paste

    Range("C325").Select
    ActiveSheet.Paste

    Range("C346").Select
    ActiveSheet.Paste

    Range("C367").Select
    ActiveSheet.Paste

    Range("C388").Select
    ActiveSheet.Paste

    Range("C409").Select
    ActiveSheet.Paste


    Range("C31:AU429").Select
    Range("AU429").Activate
    Application.CutCopyMode = False
    Application.Calculation = xlAutomatic
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    End Sub

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro to more efficiently copy/paste every 21 rows

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    11-23-2013
    Location
    OKC, Ok
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to more efficiently copy/paste every 21 rows

    Sorry about that, I am new to the forum. thanks for the information. Here is my post, updated.


    Please Login or Register  to view this content.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro to more efficiently copy/paste every 21 rows

    Try this…

    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Macro to more efficiently copy/paste every 21 rows

    Try
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: Macro to more efficiently copy/paste every 21 rows

    Does this come close to what you have in mind?
    Try it on a copy of your workbook.

    Please Login or Register  to view this content.
    OK jindon. Short and to the point.
    Last edited by jolivanes; 11-23-2013 at 03:09 AM. Reason: Saw jindons reply

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Vba/Macro Search Rows for value and copy/paste accordingly
    By Aquabat in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-21-2013, 02:56 PM
  2. Excel 2007 : Excel macro to copy/paste every nth rows
    By jay36429 in forum Excel General
    Replies: 6
    Last Post: 11-07-2011, 07:28 AM
  3. Macro to Copy/Paste 4 Rows over 500 Rows
    By snapa in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-20-2009, 12:21 PM
  4. A macro to copy and paste four rows
    By d_rock90 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2008, 10:15 PM
  5. create macro to copy paste many rows at once
    By asaya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2008, 03:47 PM

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