+ Reply to Thread
Results 1 to 4 of 4

VBA Macro solution needed to replace a particular character under specific circumstances

  1. #1
    Registered User
    Join Date
    07-18-2018
    Location
    London,England
    MS-Off Ver
    2016 Professional
    Posts
    4

    VBA Macro solution needed to replace a particular character under specific circumstances

    I have a huge list of identifiers in column B of my spreadsheet which take either of the following four structures:

    4056156
    H27372
    16-07192
    Y99-07307

    I need a VBA code which I can add into my worksheet data prep macro which will replace the "-" with "/".

    The sticking point for me is that I only need to do this in the case of those identifiers which look like 16-07192 (two digits,-,5 digits).
    For those identifiers which look like Y99-07307 (Y,two digits,-,5 digits) I need the "-" to remain as it is.

    I'm fairly new to VBA programming and can't seem to get my head around this one or find a solution anywhere. I'd be really grateful for some help here. Thanks.
    Last edited by Scepticseeker; 07-18-2018 at 05:00 PM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA Macro solution needed to replace a particular character under specific circumstanc

    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    07-18-2018
    Location
    London,England
    MS-Off Ver
    2016 Professional
    Posts
    4

    Re: VBA Macro solution needed to replace a particular character under specific circumstanc

    Fantastic that works great. Wouldn't have got there by myself, my VBA knowledge is as yet far too limited. Thank you so much!

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA Macro solution needed to replace a particular character under specific circumstanc

    Quote Originally Posted by Scepticseeker View Post
    Fantastic that works great. Wouldn't have got there by myself, my VBA knowledge is as yet far too limited. Thank you so much!
    Yoo're welcome,
    regards, JLG

+ 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: 11-27-2013, 10:43 AM
  2. [SOLVED] How to replace all characters before a specific character
    By allsystems in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-08-2013, 08:40 AM
  3. [SOLVED] Truncate At Specific Character Formula - And More. - Help Needed.
    By TheProffesional in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 08-07-2013, 04:11 PM
  4. [SOLVED] Replace in specific range - simple solution needed
    By lukestkd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 07:27 AM
  5. Search and Replace a specific character
    By VegasL in forum Excel General
    Replies: 6
    Last Post: 12-09-2012, 01:26 PM
  6. [SOLVED] Need to replace specific character in the text chain
    By lipton_tea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-17-2012, 08:55 AM
  7. Replace specific character in specific position
    By BMR in forum Excel General
    Replies: 4
    Last Post: 07-22-2011, 10:51 AM
  8. replace specific character
    By cuongvt in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2007, 12:00 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