+ Reply to Thread
Results 1 to 5 of 5

VBA Loop cut/paste/skip

  1. #1
    Registered User
    Join Date
    10-23-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    16

    VBA Loop cut/paste/skip

    Very new to VBA and macros. Looking to build a macro that will cut the items in G2:H2, paste them in I2:J2, skip to the next even numbered row, cut those items (G4:H4), paste those into I4:J4, and so-on until the end of the spreadsheet. The spreadsheet has roughly 11200 rows to sort through. Any help is GREATLY appreciated!

  2. #2
    Registered User
    Join Date
    10-23-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    16

    Re: VBA Loop cut/paste/skip

    Code below:

    ```
    Sub TotalMove()
    '
    ' TotalMove Macro

    a = 2
    g = Sheet17.Cells(Rows.Count, "A").End(xlUp).Row

    For a = 2 To g Step 2

    Range("G2:H2").Select
    Selection.Cut
    Range("I2:J2").Select
    ActiveSheet.Paste

    Next a

    End Sub
    ```

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: VBA Loop cut/paste/skip

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Registered User
    Join Date
    10-23-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    16

    Re: VBA Loop cut/paste/skip

    @Mumps1 - This is perfect, thank you!

    I am still trying to learn more VBA. Would you mind providing an explanation to the code? I have never seen the "Application.ScreenUpdating" code before.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: VBA Loop cut/paste/skip

    You are very welcome. Below is the code with explanatory comments. I hope this helps.
    Please Login or Register  to view this content.

+ 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. VBA - Skip blank rows in loop and paste multiple rows in a simulation
    By Jastisid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2020, 08:09 PM
  2. [SOLVED] Skip the loop to the next row
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2016, 12:00 PM
  3. Do While loop--how to I loop (skip certain cases)
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2016, 12:04 PM
  4. Skip in loop if condition in loop is met
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 10:41 AM
  5. Use a loop but skip a row
    By amartino44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2013, 12:26 PM
  6. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  7. Replies: 0
    Last Post: 05-24-2010, 04:29 AM

Tags for this Thread

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