+ Reply to Thread
Results 1 to 5 of 5

Run a macro to place sequential numbers at each row in a range

  1. #1
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Run a macro to place sequential numbers at each row in a range

    Hi everyone,

    I am looking to add sequential numbers to a data set, however i would only want the number to increase each time a blank row was located.

    eg.

    Row 1 Yes 000001
    Row 2 Yes 000001
    Row 3 Yes 000001
    Row 4
    Row 5 Yes 000002
    Row 6 Yes 000002

    The number of rows between each gap is not predetermined.

    Please see the attached example doc for the desired outcome.

    Any assistance would be much appreciated. I have upwards of 500,000 rows to work through so a macro to process the data would be a GREAT advantage.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run a macro to place sequential numbers at each row in a range

    Please Login or Register  to view this content.

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Run a macro to place sequential numbers at each row in a range

    Hi Ethanrholt,
    try this
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-08-2014
    Location
    -
    MS-Off Ver
    -
    Posts
    68

    Re: Run a macro to place sequential numbers at each row in a range

    Hey there,
    This should do what you want:
    Please Login or Register  to view this content.
    I've attached the one you sent - it's currently set to run the macro if you press Ctrl + Shift + I, but if you put that code in any module and run it it should work.
    Example.xlsm

    EDIT: nilem's is probably more reliable. He is a forum expert after all XD

  5. #5
    Registered User
    Join Date
    09-06-2013
    Location
    Northamptonshire, England
    MS-Off Ver
    Excel 2003
    Posts
    45

    Re: Run a macro to place sequential numbers at each row in a range

    Brilliant!

    Thank you all for your quick responses. Having checked each suggestion they all seem to work perfectly.
    Trying my best to learn VBA as i go but not always quite sure what method is best to use. I'll get there eventually with help from Excel forum.

    Thanks again all. Have a great day.

+ 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. Macro to add a column of sequential numbers
    By scruz9 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2014, 02:42 PM
  2. Need code to searches every row in range and clear rows with sequential numbers.
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2013, 10:56 AM
  3. [SOLVED] How to populate a range with sequential numbers?
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2013, 03:34 AM
  4. Macro Generate Numbers in Sequential Order
    By Rem0ram in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-09-2013, 08:30 AM
  5. [SOLVED] Put Sequential Numbers in a Range
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 02:32 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