+ Reply to Thread
Results 1 to 6 of 6

Assigning a unique value to all blank cells in a column

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Smile Assigning a unique value to all blank cells in a column

    Hi Guys

    Please see attached spreadsheet

    testme.xlsx

    I have blank cells in col G and what I'd like is a macro code to assign a unique number for each blank cell in this column , for ex: 1,2,3 etc

    Thanks

    Mohammed

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Assigning a unique value to all blank cells in a column

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Assigning a unique value to all blank cells in a column

    You could use this macro:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  4. #4
    Registered User
    Join Date
    02-22-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Assigning a unique value to all blank cells in a column

    Thanks AB33 & Antonio. This now works perfectly

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Assigning a unique value to all blank cells in a column

    You may not need a macro.
    Thanks to your question and my resulting experimentation I just discovered a nice feature in Excel.

    Using your posted workbook...
    • Select Col_G
    • Press F5...shortcut for Home.Find&Select.Go_to
    ...Click: Special
    ...Check: Blanks
    ...Click: OK

    (Now all of the blank cells in Col_G are selected...with G2 as the active cell)
    • Type: 1 and press ENTER
    • Shift + ENTER...to return to G2 without unselecting the other blank cells
    • Home.Fill....Check: Series
    ...Check: Series in Columns
    ...Click: OK

    Excel will sequentially number each of the subsequent blank cells
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

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

    Re: Assigning a unique value to all blank cells in a column

    Another:

    Please Login or Register  to view this content.

+ 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