+ Reply to Thread
Results 1 to 3 of 3

Adding a dash before and after a 3 number string

  1. #1
    Forum Contributor
    Join Date
    12-03-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    184

    Adding a dash before and after a 3 number string

    Hello,

    I have a column of characters/numbers. Each cell always has a 3 number string somewhere in the cell. I would like a vba that will add a dash before and after this string. Example: hdi2n340B13 should look like hdi2n-340-B13.


    Thanks,

    E
    Last edited by enhydra; 03-17-2017 at 07:38 PM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Adding a dash before and after a 3 number string

    try this macro. You'll have to change the column the macro works on (actually column A)
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Contributor
    Join Date
    12-03-2009
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Adding a dash before and after a 3 number string

    Damn, that's cool. Works great. I didn't even have a clue where to start. You're a genius. Thanks much.

+ 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] Keeping zero and adding dash in number automatically
    By Scrapnforfun in forum Excel General
    Replies: 9
    Last Post: 05-29-2016, 03:43 PM
  2. [SOLVED] Adding a dash after every 4 characters.
    By HEMPHIL4 in forum Excel General
    Replies: 4
    Last Post: 04-29-2016, 11:17 AM
  3. [SOLVED] Adding / to number string
    By DSou in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-21-2015, 08:19 AM
  4. [SOLVED] how can i get a dash after the first word in a string
    By sumesh56 in forum Excel General
    Replies: 3
    Last Post: 10-22-2014, 01:06 PM
  5. [SOLVED] Formula or Macro, match string,from 1 cell to a column,String use dash
    By david gonzalez in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-07-2013, 06:03 PM
  6. Excel 2007 Adding Number Separated by a Dash
    By tnoble17 in forum Excel General
    Replies: 1
    Last Post: 01-16-2010, 10:07 AM
  7. number as string and adding spaces to it
    By A.New in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2005, 11:06 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