+ Reply to Thread
Results 1 to 4 of 4

Adding Numbers As Strings And Keeping Format

  1. #1
    Registered User
    Join Date
    06-01-2015
    Location
    Derby, England
    MS-Off Ver
    2013
    Posts
    87

    Adding Numbers As Strings And Keeping Format

    I have a sheet which has a series alphanumeric references, the reference is always BISxxxx where xxxx is a four digit number starting at 0001 and progressing 0002, 0003 etc.

    I have a button on my sheet which runs VBA code to add a new row with the new reference in the progression.

    The part of my code that calculates the numeric part of the new reference is

    Please Login or Register  to view this content.
    In this instance I get the following

    OldRef = BIS0001
    OldRefNumber = 0001
    NewRefNumber = 2

    My problem is that I am losing the format of 000x, how to I make sure this is kept?

    When I reach the tenth reference is needs to be 00xx and so on.

    Hope this makes sense and someone can help me.

    Ed

  2. #2
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Adding Numbers As Strings And Keeping Format

    Maybe this:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-01-2015
    Location
    Derby, England
    MS-Off Ver
    2013
    Posts
    87

    Re: Adding Numbers As Strings And Keeping Format

    Akuini,

    A perfect solution. Thanks.

    Ed

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Adding Numbers As Strings And Keeping Format

    Hi, Ed,

    why not shorter with
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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. [SOLVED] Converting Numbers to Text but Keeping Format
    By EdWoods in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-26-2014, 08:14 PM
  2. HELP adding numbers in HH:MM format to give a general total?
    By BEN HM in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-15-2014, 08:31 AM
  3. [SOLVED] Format individual strings out of multiple strings within a cell with VBA
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-18-2013, 07:33 PM
  4. Matching Strings in two columns and keeping the data that matches
    By camdenl08 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-26-2013, 01:15 AM
  5. Replies: 3
    Last Post: 05-23-2009, 05:46 AM
  6. I need to format various strings (numbers, dates) precisely
    By durandal05 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2008, 08:55 PM
  7. Keeping track of unique strings in a column
    By praame in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2007, 05:28 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