+ Reply to Thread
Results 1 to 6 of 6

Use input box to add prefix to currently populated cells

  1. #1
    Registered User
    Join Date
    06-28-2012
    Location
    Shawano, WI
    MS-Off Ver
    MS365 version 2310
    Posts
    98

    Use input box to add prefix to currently populated cells

    Hello -

    I receive excel files that would have a column that has ID's of animals and I need to place a prefix in front of the animal numbers based on the number itself. I would like to use VBA and an Input Text Box to do this.

    Some examples would be:

    If Column A had 12xys1234 the individual would type HOUSA000 in the input text box.
    If Column A had 982012345678912 the individual would type HO in the input text box.

    The macro would take the information that was typed into the input box and insert this in front of the contents of column A.


    Currently I am using the Formula ="HOUSA0000"&a2, but I am now training others to process these items and they are not as comfortable with formulas.

    Any help would be much appreciated.

    Thank you!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: Use input box to add prefix to currently populated cells

    Try this:
    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-28-2012
    Location
    Shawano, WI
    MS-Off Ver
    MS365 version 2310
    Posts
    98

    Re: Use input box to add prefix to currently populated cells

    Thanks Alan, the code you sent it worked very nicely.

    One additional Question, how do I program it to automatically continue to the last row of data and not have the input box show for each cell?

    Example: a person would type in HOUSA0000 for the first input box and click OK, then the macro would use this for the whole column.

    Thanks again!

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: Use input box to add prefix to currently populated cells

    Here is the modified code:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-28-2012
    Location
    Shawano, WI
    MS-Off Ver
    MS365 version 2310
    Posts
    98

    Re: Use input box to add prefix to currently populated cells

    Yes, that was it.

    Thanks!!

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,904

    Re: Use input box to add prefix to currently populated cells

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Add Standard Prefix To Cells
    By zulhfreelancer in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 06-09-2013, 07:11 AM
  2. [SOLVED] Prompt input of future date in cell when another cell has been populated or modified
    By coffeemints in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 06:46 PM
  3. [SOLVED] Cell not remaining blank when input field is not populated
    By JRose0303 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-17-2012, 12:55 PM
  4. Add prefix in a range of cells
    By liapisit in forum Excel General
    Replies: 4
    Last Post: 04-06-2010, 09:51 AM
  5. how to add a constant prefix to an existing list of populated cells
    By brit6400 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2010, 03:11 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