+ Reply to Thread
Results 1 to 5 of 5

VBA To Create Suffix

  1. #1
    Registered User
    Join Date
    12-08-2015
    Location
    Birmingham, England
    MS-Off Ver
    2007
    Posts
    44

    VBA To Create Suffix

    Hi,

    I have a column of references such as:

    602
    602
    603
    604
    604
    604

    I need some VBA to add a letter on the end of each string to make each one unique. So the above should read:

    602A
    602B
    603A
    604A
    604B
    604C

    There is always a different amount of references in column A so need VBA to automatically detect this and change each one. Once it gets to Z, it should carry on with AA, AB, AC, etc.

    Thanks for your help.

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

    Re: VBA To Create Suffix

    This is assuming there is a header in column A. It will go to ZZ if neccessary.

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA To Create Suffix

    This goes up to XFD for one item.
    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA To Create Suffix

    Hi and welcome to the forum,

    Is it vital to have a letter rather than a suffix like 602_1, 602_2, 603_1 ..etc.
    It would be a doddle if that was permitted and no need for VBA.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

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

    Re: VBA To Create Suffix

    How about just a formula?

    Row\Col
    A
    B
    C
    1
    602
    602A B1: =A1 & SUBSTITUTE(ADDRESS(1, COUNTIF(A$1:A1, A1), 4), 1, "")
    2
    602
    602B
    3
    603
    603A
    4
    604
    604A
    5
    604
    604B
    6
    604
    604C
    Entia non sunt multiplicanda sine necessitate

+ 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. Prefix and Suffix Help
    By Scott Holmes in forum Excel General
    Replies: 3
    Last Post: 10-06-2015, 11:58 AM
  2. Add suffix to Tab Name if it already exists
    By tigerdel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2014, 11:58 AM
  3. [SOLVED] Changing a positive or negative value based on the input's suffix, then removing suffix
    By Theredwind in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-06-2014, 05:19 AM
  4. question about suffix
    By prahaladje in forum Excel General
    Replies: 1
    Last Post: 09-24-2010, 06:50 AM
  5. Add Suffix & Prefix
    By di22y in forum Excel General
    Replies: 1
    Last Post: 06-25-2009, 06:34 PM
  6. [SOLVED] How do I had a suffix to a cell i.e. -1,-2,-3?
    By controller_woman in forum Excel General
    Replies: 1
    Last Post: 07-12-2005, 01:05 PM
  7. [SOLVED] I'd like to add a suffix...
    By Dr. Darrell in forum Excel General
    Replies: 4
    Last Post: 06-18-2005, 12:05 PM

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