+ Reply to Thread
Results 1 to 3 of 3

VBA copy multiple lines within For Loop

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

    VBA copy multiple lines within For Loop

    How would you go about printing information on a second line while still in the same "a" in the for loop?

    Referencing the below code, away_ml should be printed in (4,5), but home_ml should be in (5,5). Currently, the code I have prints the first line correctly, but then does not print the "a+1" like I am intending.

    I don't think I can use the Step method in the intial for loop line (For a=4 to g step 2) as I would miss rows that I need to pull information from.

    Uploaded is an example file with it correctly copied on the right hand side of the sheet. Below is my current code.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: VBA copy multiple lines within For Loop

    You should use another variable for the destination row as it's no always the same as the source row.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

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

    Re: VBA copy multiple lines within For Loop

    Quote Originally Posted by Norie View Post
    You should use another variable for the destination row as it's no always the same as the source row.
    Please Login or Register  to view this content.
    This worked perfectly - thanks for the insight!

+ 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] Print out multiple lines in a textbox via a loop
    By hoi2you in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2020, 08:57 AM
  2. Replies: 13
    Last Post: 10-01-2019, 05:07 PM
  3. [SOLVED] Loop and copy every x lines of range
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-12-2018, 05:53 AM
  4. [SOLVED] Loop through lines in a text file ignoring lines between two different strings
    By webwyzard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2018, 08:00 PM
  5. [SOLVED] Loop and delete lines till no more lines left to check
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2018, 08:15 AM
  6. loop copy paste and average of multiple lines
    By cboseva in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2018, 06:20 PM
  7. [SOLVED] Creating a Macro Loop to copy & paste several lines
    By homike2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 07:10 PM

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