+ Reply to Thread
Results 1 to 10 of 10

Adding blank rows

  1. #1
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Adding blank rows

    Hello All,

    I need help writing a macro that will add blank rows based on cell values. I've attached a sample table to show what I mean. I have a list of names and box numbers. While the box numbers are in numerical order, they skip some numbers by design. What I want to do is have a macro that will see when a number is skipped and add a row (or more in some cases) for it. The new rows do not need to have the missing numbers placed in them, just having the blank space is enough.

    Thanks


    Book1.xlsx

  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: Adding blank rows

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Adding blank rows

    John,

    Thanks! That worked perfectly. I ran it a couple of times with my actual data and it worked, however, a few times it stopped before cycling though the whole list. I ended up running it twice and it finished. Any thoughts on why it might do that?

  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: Adding blank rows

    You're welcome. I don't know why it stopped, no thoughts on that. Did you receive an error message when it stopped?

  5. #5
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Adding blank rows

    No. I did not receive any error message. I'll keep running various tests of differing size today to see what happens.

  6. #6
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Adding blank rows

    I've run data through this macro several more times and haven't run into any more issues regarding it stopping early. However, it does seem to keep running well past my data set. Is there a way to tell it to stop after it hits 3000 rows, since my data will never be longer?

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

    Re: Adding blank rows

    Maybe:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Adding blank rows

    John - this didn't work. I've tried tweaking it in other ways all to no avail. I'll keep at it though.

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

    Re: Adding blank rows

    It's the same macro that you said was working before? The only thing I change was the count to 3000, as you requested?

  10. #10
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    164

    Re: Adding blank rows

    I'm not sure what happened, but I copied and pasted it and tried to run it three times, but kept getting 'runtime error 13'. On the fourth time, without changing anything it ran. Thanks for the help. I was hoping that by limiting the range it would run faster, but it still takes a while to process. Oh well, it works and that's what counts.

+ 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. Adding text to specific blank rows
    By mayurpatil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-21-2012, 03:19 AM
  2. Adding two blank rows
    By missytordrup in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2011, 03:57 AM
  3. Adding blank rows between series of row
    By Shadmani in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-23-2010, 04:12 AM
  4. Adding a blank row in between excisting rows
    By ..Sam.. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-21-2009, 12:53 AM
  5. Adding Blank Rows
    By John1950 in forum Excel General
    Replies: 2
    Last Post: 09-19-2007, 09:26 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