+ Reply to Thread
Results 1 to 6 of 6

Macro to delete all text and characters BUT numbers (including decimals) from excel

  1. #1
    Registered User
    Join Date
    12-31-2014
    Location
    london, england
    MS-Off Ver
    2010
    Posts
    3

    Macro to delete all text and characters BUT numbers (including decimals) from excel

    Hello there!
    I hope someone can help me here. I have been searching for a solution for this for a long time without any joy.

    I need to delete all text and characters BUT numbers (including decimals) from my exel spreadsheets. I am using office 2007. Is there a macro to do this?
    for example I want a cell containing "brownfox (123.13)" to remain with just "123.13", a cell containing "brown12white" to remain with just "12", a cell containing "blue 1.32" to remain with just "1.32", a cell containing "black10" to remain with just "10", a cell containing "white 2" to remain with just "2". Need to do this for many records

    Please help. Thanks in advance!

    Regards

    Cool

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: Macro to delete all text and characters BUT numbers (including decimals) from excel

    Hi Cool and welcome to the forum.

    See if this code in the example works for you.
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro to delete all text and characters BUT numbers (including decimals) from excel

    UDF using Regular Expression
    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    12-31-2014
    Location
    london, england
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to delete all text and characters BUT numbers (including decimals) from excel

    Quote Originally Posted by MarvinP View Post
    Hi Cool and welcome to the forum.

    See if this code in the example works for you.
    Please Login or Register  to view this content.
    Hi MarvinP
    Thanks for your swift response. I have tried the code but unfortunately its not working. The cells to be changed are in several columns and many rows of the spreadsheet. Could this be the problem?

    Kind regards
    Cool

  5. #5
    Registered User
    Join Date
    12-31-2014
    Location
    london, england
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to delete all text and characters BUT numbers (including decimals) from excel

    Quote Originally Posted by humdingaling View Post
    UDF using Regular Expression
    Please Login or Register  to view this content.
    Hi humdingaling
    Thanks for your swift response. I have tried the code but unfortunately its not working. The cells to be changed are in several columns and many rows of the spreadsheet. Could this be the problem?

    Kind regards
    Cool

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro to delete all text and characters BUT numbers (including decimals) from excel

    the UDF is designed to tackle one cell at time
    in your initial example this is what it sounded like you were trying to do

    i will have another look tomorrow to convert range of cells

+ 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. Macro to delete row if the first characters are numbers
    By Ilwuen in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-20-2014, 05:14 PM
  2. [SOLVED] Is there a formula to delete whole numbers but leave decimals?
    By Miss Molko in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-22-2014, 08:46 AM
  3. [SOLVED] Convert all numbers stored as text or custom formatted to numbers &no decimals - 40 sheets
    By synses in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 01:46 AM
  4. find text then delete two rows below it including row of found text
    By leanne2011 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2011, 08:05 AM
  5. Export multiple columns to single column text files including special characters
    By mike4uuu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2011, 04:54 AM
  6. Extract Numbers and Decimals from Text
    By PY_ in forum Excel General
    Replies: 6
    Last Post: 11-12-2010, 04:10 PM
  7. Replies: 2
    Last Post: 01-27-2006, 03:35 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