+ Reply to Thread
Results 1 to 2 of 2

VBA - delete text b/w first and second space in a string of text - apply to selected range

  1. #1
    Registered User
    Join Date
    06-16-2018
    Location
    Unites States
    MS-Off Ver
    2016
    Posts
    5

    VBA - delete text b/w first and second space in a string of text - apply to selected range

    I'm using the following formula to return everything in the referenced cell except the text between the first and second space. The word b/w the first and second space has to be taken out. I have several hundred cells that I need to apply this to in different workbooks.

    =CONCATENATE(LEFT(A1,(FIND(" ",A1,1)-1))," ",MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,256))

    I was wanting to be able to select a range of cells on the sheet that I need to apply this formula to, and then have a macro loop through all the cells that I have selected and make the change.

    For example,

    If a cell has "John Smith California Unites States", I need it to change to "John California United States"

    It will always be the word between the first and second space that I need to take out.


    I started to do something like below, but I don't know if this is the right approach or not...Any help would be greatly appreciated.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: VBA - delete text b/w first and second space in a string of text - apply to selected r

    Please Login or Register  to view this content.
    Last edited by protonLeah; 06-16-2018 at 03:55 PM.
    Ben Van Johnson

+ 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. Replies: 2
    Last Post: 05-27-2016, 12:30 AM
  2. Delete Characters Before Last Space In Text String [SOLVED]
    By alacey425 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-01-2016, 11:30 PM
  3. Replies: 0
    Last Post: 06-16-2015, 08:52 AM
  4. If Cell Text Matches Any Text From Range, Then Apply VLOOKUP?
    By eliot1171 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2013, 09:41 PM
  5. Replies: 3
    Last Post: 05-25-2012, 05:45 PM
  6. Combining selected text into a long string of text
    By bruce71101 in forum Excel General
    Replies: 1
    Last Post: 02-22-2011, 02:42 AM
  7. Extract text from string after , before a space
    By Dulanic in forum Excel General
    Replies: 1
    Last Post: 05-24-2010, 08:20 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