+ Reply to Thread
Results 1 to 4 of 4

How to copy into next empty row using "for each cell in range" loop

  1. #1
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    How to copy into next empty row using "for each cell in range" loop

    Hi. I'm trying to first identify specific strings in a range, and then copy the entire row they belonged to into the first empty row in another sheet. I'm using loop because I need the macro to accumulate all relevant rows. In the sample file keyword is "div", but in d_t sheet only the last relevant row is being copied, while these two also should be copied.. any ideas?
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Please * if you like the answer

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to copy into next empty row using "for each cell in range" loop

    Made a few changes.

    Please Login or Register  to view this content.
    First observation is my_rng was set to start at C2, whereas your data started at C1.

  3. #3
    Forum Contributor
    Join Date
    12-30-2012
    Location
    Israel
    MS-Off Ver
    2007, 2016
    Posts
    642

    Re: How to copy into next empty row using "for each cell in range" loop

    Cheers John! Could you please say a word about END's arguments in my case? END(3)(2)..

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to copy into next empty row using "for each cell in range" loop

    You're welcome. The (3) is an xl Constant I use in place of (xlup). The (2) is another way to offset a cell - translation .Offset(1).

+ 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] Loop to check for "yes" then copy the IDs with "yes" and paste to other workbook
    By Hallet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-11-2012, 12:41 PM
  2. coping a range into the next available empty cell in column "A"
    By joe dech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2011, 11:52 AM
  3. transpose loop with "empty cell" condition
    By ana_cociorva in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2011, 04:24 PM
  4. Why does =countif(range,"<>""") count empty cells?
    By Ingeniero1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2008, 01:40 PM
  5. Do Loop until empty row (column "A")
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-17-2005, 10:01 AM

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