Results 1 to 7 of 7

VBA, remove all characters within a string, except numerical characters and full stops

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Bristol, England
    MS-Off Ver
    Excel 2003
    Posts
    471

    VBA, remove all characters within a string, except numerical characters and full stops

    I'm after a code that would remove all characters within a string that are not numbers (1234567890) and aren't full stops (.)


    So lets say I have a string of text "ts [$11.40 USD]" (without quotes) in col F
    Then after I would run the macro, it would only leave "11.40"
    I'm looking for an easy and efficient code.

    I have piece of code below that replaces "]" with blanks "". That is just an example that I would like to replace with something as described above.
    Any help is very much appreciated. Any ideas?


    Sub simple_test()
    For r = 2 To 30
    
    'the line below replaces "]" with blanks e.i. ""
    Sheets("Sheet1").Range("G" & r) = Replace(Sheets("Sheet1").Range("G" & r), "]", "")
    
    Next r:
    End Sub
    Last edited by rain4u; 02-25-2015 at 05:34 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA Remove First 10 Characters From string
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2013, 08:22 AM
  2. [SOLVED] Remove certain characters from the end of a string only
    By mini_dutch28 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-20-2012, 01:04 PM
  3. Remove characters in a string.
    By jncswe in forum Excel General
    Replies: 2
    Last Post: 09-10-2010, 07:26 AM
  4. Remove Characters From Right of String
    By milagros in forum Excel General
    Replies: 11
    Last Post: 12-26-2009, 12:01 PM
  5. Remove last 4 characters from cell string?
    By chris-uk-lad in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2009, 07:01 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