+ Reply to Thread
Results 1 to 1 of 1

remove a special character using VBA

Hybrid View

phwjr remove a special character... 12-06-2013, 02:33 PM
  1. #1
    Registered User
    Join Date
    12-06-2013
    Location
    Atlanta, Georgia
    MS-Off Ver
    Excel 2010
    Posts
    1

    Cool remove a special character using VBA

    "+0.28 - +0.16%"
    "+3.42 - +0.61%"
    "-2.62 - -0.25%"
    "-0.44 - -0.53%"


    In the above example I have pulled this information from yahoo finance which indicates a stock's Change in price and the % change in price.

    I have written some code in VBA that will remove the quotes at the beginning and the end of the string but I cannot seem to find a way to remove the "-" (which is in bold) from the middle of the string.

    The "-" is actually chr(45)

    The format for this information would look better if the extra minus sign was replaced with a "/" to give it a separator.

    Since the information is indicating change there still could be a negative change but it seems as though the format adds in an extra character Chr(45) or the minus sign "-"

    If possible may I get and example of removing it and then code to replace the "-" with a "/"

    Application.ScreenUpdating = False
                For Each e In Range("h11", Range("H" & Rows.Count).End(xlUp))
                    If Left(e, 1) = (Chr(34)) Then e = Mid(e, 2, Len(e) - 1)
                    If Right(e, 1) = Chr(34) Then e = Left(e, Len(e) - 1)
                    'If Right(len = Chr(45) Then e = Len(e) - 11
                Next e
    
            Application.ScreenUpdating = True
    May I please get some help on this or for someone to point me in the right direction with an example

    Thanks in advance
    Last edited by JBeaucaire; 12-08-2013 at 11:11 AM. Reason: moved to correct forum, added CODE tags. Please read the FORUM RULES, link in menu bar above. Thanks.

+ 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. how to remove the * special character in excel
    By mohan_srijaya in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-14-2013, 06:26 PM
  2. Need to highlight special character and the cells contains special character
    By dhilipan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2013, 01:36 AM
  3. Macros to remove a special character and all the characters after that....
    By Umapathy kumar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2013, 01:27 AM
  4. Replies: 2
    Last Post: 10-24-2011, 07:54 AM
  5. remove special character at end of string
    By captain bob in forum Excel General
    Replies: 0
    Last Post: 08-03-2006, 09:59 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