+ Reply to Thread
Results 1 to 8 of 8

Macro to insert new line after number increases

  1. #1
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Macro to insert new line after number increases

    Hello happy campers.
    I have a sheet with various information, in column A are the delivery reference numbers, some of which can appear any number of times according to how many lines the order will have.
    My macro currently does
    Please Login or Register  to view this content.
    I would now like some code that will look through Column A (now is has been sorted A-Z) and lets say the first delivery number is 1234567891, when this number then changes to the next i would like the code to insert an empty row. (see attached)

    As always, your input is much appreciated.
    galvinpaddy
    Attached Files Attached Files
    Last edited by galvinpaddy; 11-22-2011 at 11:14 AM. Reason: updated

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to insert new line after number increases

    Like so:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 11-18-2011 at 12:13 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Re: Macro to insert new line after number increases

    Hello,

    Thanks for your reply, when i try to run the macro i get an error

    'Runt-time error '6':
    Overflow

    And it highlights the following line as the issue
    Please Login or Register  to view this content.
    Please advise

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to insert new line after number increases

    Please Login or Register  to view this content.
    Sorry about that.

  5. #5
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Re: Macro to insert new line after number increases

    No need to be sry fella, your already helping me a great deal!!
    Rep. added, many thanks fella.

    galvinpaddy

  6. #6
    Forum Contributor
    Join Date
    11-02-2011
    Location
    Rugby, England
    MS-Off Ver
    Office 365
    Posts
    846

    Re: Macro to insert new line after number increases

    please mark as solved
    Thankyou

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to insert new line after number increases

    Please take a few minutes to read the forum rules, and then you can mark it as Solved.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to insert new line after number increases

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    (this instruction is found as rule #9 in the Forum Rules, be sure to read through them,very helpful (and required))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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