+ Reply to Thread
Results 1 to 5 of 5

macro for remove number or letter from cell

  1. #1
    Registered User
    Join Date
    08-07-2009
    Location
    baltimore, md
    MS-Off Ver
    Excel 2003
    Posts
    15

    macro for remove number or letter from cell

    I am looking for 2 different Macros

    I have a list of 100 (A1:A10000) names followed by numbers in the same cell. I would like to create a macro that will remove the numbers but will leave the name alone and like wise, remove name but leave numbers. For example:

    John123 will be changed to John with the remove number macro

    12Pete will be changed to Pete with the remove number macro

    1D2a3n will be changed to Dan with the remove number macro

    AND


    John123 will be changed to 123 with the remove Letter macro


    12Pete will be changed to 12 with the remove letter macro

    1D2a3n will be changed to 123 with the remove letter macro

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: macro for remove number or letter from cell

    These two UDFs will do what you want. You can use them as cell formulas, or call them from within other VBA.
    Please Login or Register  to view this content.
    Used in a cell as:

    =NumOnly(A1)
    =TextOnly(A1)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: macro for remove number or letter from cell

    Here's an example of how you can use the UDFs within another macro. With this macro, you select any range you want (column, row, or specific range) and activate the SelectChange macro and it will ask you what you want to do:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-07-2009
    Location
    baltimore, md
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: macro for remove number or letter from cell

    oh wow thank you so much!!!
    Last edited by dancmin; 10-07-2009 at 05:24 PM.

  5. #5
    Registered User
    Join Date
    08-07-2009
    Location
    baltimore, md
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: macro for remove number or letter from cell

    jbeauclaire,
    I cannot call the function i have to input

    =Personal.xlsb!textonly(a1)

    is there a way i can do JUST =textony(a1)?
    Last edited by dancmin; 10-07-2009 at 05:25 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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