+ Reply to Thread
Results 1 to 4 of 4

Loop through rows in an excel worksheet and copy a range if the last cell isn't blank

  1. #1
    Registered User
    Join Date
    01-06-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    3

    Loop through rows in an excel worksheet and copy a range if the last cell isn't blank

    I have looked and have not been able to find an efficient solution for what I am trying to do. I found the following code but I have to repeat the code as I have a cell that is not blank. I need to copy range(A2:O2) to another sheet and repeat this row being copied (looped) for every cell that has data starting in P2 and going out "n" number of cells in the same row. Each time the row is copied to the next blank row on the new sheet, I need the next number (starting in column P and going out "N" times) copied into column P, in the new row. I can send a spreadsheet as an example, but I don't know how to put it in this question. Please help. Here is the code:

    Please Login or Register  to view this content.
    Last edited by JWHeel; 01-09-2017 at 05:21 PM. Reason: Needed to add code tags

  2. #2
    Forum Contributor
    Join Date
    05-02-2015
    Location
    calgary alberta
    MS-Off Ver
    2012
    Posts
    205

    Re: Loop through rows in an excel worksheet and copy a range if the last cell isn't blank

    For the love of sweet baby Jesus put code tags around that

  3. #3
    Registered User
    Join Date
    01-06-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    3
    Quote Originally Posted by SPARKY347 View Post
    For the love of sweet baby Jesus put code tags around that
    Hi Sparky347,
    Sorry about that. I am fairly new to VBA and this is my first ever forum post. I will look this up and fix it.

  4. #4
    Registered User
    Join Date
    01-06-2017
    Location
    United States
    MS-Off Ver
    2013
    Posts
    3

    Re: Loop through rows in an excel worksheet and copy a range if the last cell isn't blank

    This has been fixed. Thanks for the heads up.

+ 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] 2nd loop: Delete rows with blank ranges in each worksheet
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-30-2016, 10:27 AM
  2. Loop Across Columns...If Blank Cell, Loop Down Rows
    By flindy87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2014, 07:05 PM
  3. Loop Across Columns If Blank Cell Loop Down Rows
    By flindy87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2014, 10:22 AM
  4. Copy 1 cell formula to a range of cells and loop every 3 rows
    By ArtPur in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-02-2013, 09:54 AM
  5. Excel - macro to loop through row data and copy cell to each worksheet in the workbook
    By swilson2006 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2013, 07:54 AM
  6. Copy certain cells from one worksheet to another worksheet with blank rows
    By pmarsella in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2009, 07:57 AM
  7. Loop to copy rows and paste into worksheet
    By damien_carr1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2009, 06:10 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