+ Reply to Thread
Results 1 to 5 of 5

VBA code for adding text prefix to an integer

  1. #1
    Registered User
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    3

    VBA code for adding text prefix to an integer

    Hi Everyone

    I would like to add a text prefix to a number I have created as an integer, as follows:

    Dim POnumber As Integer
    '
    POnumber = Sheets("Register2").Cells(Rows.Count, "A").End(xlUp) + 1

    The "POnumber" is to increase by 1 on the search in a table, I then want to add the letters "PO" to the beginning of this new number.

    Thank you.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA code for adding text prefix to an integer

    If you want POnumber = the last used row you have to change so
    Please Login or Register  to view this content.
    If you want add the letters "PO" to the beginning of POnumber
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: VBA code for adding text prefix to an integer

    Try:

    Please Login or Register  to view this content.
    Gary's Student

  4. #4
    Registered User
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA code for adding text prefix to an integer

    Hi Patel45

    Thanks for the help, it worked perfectly.

  5. #5
    Registered User
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA code for adding text prefix to an integer

    Hi Jakobshavn

    Thanks for the reply.

+ 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