+ Reply to Thread
Results 1 to 3 of 3

Macro for adding text, spacing, and a replace in a text string.

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro for adding text, spacing, and a replace in a text string.

    I am a total beginner and I am at a loss on how to achieve this. My goal would be instantly create a file index based on a file list I import into excel. I would like to take something like the following text in a cell...
    01 Draft Discussion Document - Appendix A.pdf” and have it changed to
    Tab 01__________Draft Discussion Document - Appendix A”.
    I cant figure out how to go about this smartly.
    Is there way to add (10 spaces) at the position of the first space, add “Tab” at the front, and delete the (.pdf/.PDF) at the end? I would want to apply this to all the cells that contain text in Column A.

    * I had to use underscores in my example above, in its place would be 10 spaces.

    Thanks very much.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro for adding text, spacing, and a replace in a text string.

    Your formula in column B is:-

    Please Login or Register  to view this content.
    If you want to use a macro to do this on all of column A then:-

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-16-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro for adding text, spacing, and a replace in a text string.

    Amazing. And so clean. I had something that was halfway working, a combination of individual pieces I knew can work. I would have never thought of an approach like this. VERY much appreciated, and happy holidays!

+ 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] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  2. [SOLVED] VBA to Search a Text String, Find a Value listed in another column and replace the text
    By Jschrod303 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2012, 08:56 PM
  3. [SOLVED] macro replace a string with certain text..?
    By adbasanta in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-09-2012, 09:40 AM
  4. Adding text to the end of existing string / text.
    By DTK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2010, 02:51 AM
  5. Replace Text in a String
    By newbieexceldude in forum Excel General
    Replies: 4
    Last Post: 03-29-2010, 10:55 PM

Tags for this Thread

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