+ Reply to Thread
Results 1 to 5 of 5

Need help with code to get the numbers from string

  1. #1
    Registered User
    Join Date
    09-28-2018
    Location
    Sauk Rapids MN
    MS-Off Ver
    10
    Posts
    20

    Unhappy Need help with code to get the numbers from string

    Need help with code to get the numbers from string
    My code works but leave a space on strings with 6 digits

    Need to remove space

    Rev = Right(tmp, 7)

    Strings
    Additive Rinse 4959856
    Beef 80/20 Ground 513019
    Bun Kaiser 716449
    Cabbage Shredded 143411

    Thanks
    Lyle

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,093

    Re: Need help with code to get the numbers from string

    You could use Application.WorksheetFunction.Trim(Right(tmp, 7))
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Need help with code to get the numbers from string

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    09-28-2018
    Location
    Sauk Rapids MN
    MS-Off Ver
    10
    Posts
    20

    Re: Need help with code to get the numbers from string

    I'm sorry
    I may not of been clear
    I need a VBA code
    to do your excel statement
    TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",255)),255))

    Thanks
    Lyle

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Need help with code to get the numbers from string

    Please Login or Register  to view this content.
    Last edited by sintek; 12-22-2020 at 01:11 AM.

+ 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: 7
    Last Post: 02-07-2020, 05:17 AM
  2. [SOLVED] Formula to Find a Match of String of Numbers in a Larger String of Numbers
    By MattAquino in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-16-2019, 12:30 PM
  3. [SOLVED] Simplification for regex code to replace numbers in a comma delimited string
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2018, 06:30 AM
  4. Extracting numbers from a string in a cell without recurring to VBA code
    By Guido Meng in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-09-2013, 12:20 PM
  5. [SOLVED] Need code to pull numeric data out of an alphanumeric string (string not constant)
    By harrydnyc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 04:44 PM
  6. [SOLVED] Remove numbers from alphanumeric string. No standard format to the string.
    By ricunger in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2012, 01:43 PM
  7. Replies: 2
    Last Post: 08-23-2012, 04:58 PM

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