+ Reply to Thread
Results 1 to 5 of 5

VBA string manipulation, move '_' to one character left

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    VBA string manipulation, move '_' to one character left

    is it possible to create a VBA to find the last underscore in highlighted cells, and move that underscore to 1 character left?

    For example,

    MOV_112A_BC

    into

    MOV_112_ABC

    Only the 2nd '_' should move 1 character to the left.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA string manipulation, move '_' to one character left

    What do you men by "highlighted cells": Is it the selected cells ?
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: VBA string manipulation, move '_' to one character left

    If it is then try

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: VBA string manipulation, move '_' to one character left

    =replace(c66,8,4,"")&"_"&mid(c66,8,1)&right(c66,2)
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Registered User
    Join Date
    09-10-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: VBA string manipulation, move '_' to one character left

    Thanks PCI, it worked!

    Will try and understand the code tonight.

+ 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. string manipulation, move letter back in the string
    By hammerjoe in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-22-2016, 12:49 PM
  2. [SOLVED] String Move from Left to Right
    By Echo_711 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-06-2014, 11:17 PM
  3. [SOLVED] Find text left or right of a specific character in a text string
    By Locopete99 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-14-2014, 05:55 AM
  4. [SOLVED] SUMIF, SUMPROD, LEN, LEFT, cond sum checking string's length and initial character cells
    By Dolphin74 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-23-2012, 05:16 AM
  5. Replies: 3
    Last Post: 11-20-2012, 10:03 PM
  6. [SOLVED] Sum numbers left of a character from within a string
    By BarryTSL in forum Excel General
    Replies: 14
    Last Post: 04-17-2012, 01:11 PM
  7. Truncating part of string to the left of a character
    By UrbanEast in forum Excel General
    Replies: 4
    Last Post: 12-12-2010, 02:37 AM

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