+ Reply to Thread
Results 1 to 6 of 6

Extract Numerical part with VB Code

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Extract Numerical part with VB Code

    Hello:

    Please refer to attached file.

    I need a VB Code to replace the cell value by the numrical part of the string.
    For Example:

    Employee# 3 AMY
    Employee# 5 DARLENE
    Employee# 5 DARLENE
    Employee# 6 ANGIE
    Employee# 7 CHASETY

    would become
    3
    5
    5
    6
    7


    Please Let me Know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Extract Numerical part with VB Code

    try this...if you want column A written over just change the range inside the FOR Loop from "B" to "A"

    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Extract Numerical part with VB Code

    See attached file...
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Numerical part with VB Code

    Hi judgeh39:

    Thank you so much for quick help, this works.
    However, the number of data will vary so x = 2 to Y where y needs to be the last data

    Please modify the code to incorporate this.

    Let me Know if you have any questions.
    Thanks.

    Riz

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Extract Numerical part with VB Code

    sorry....I was just being lazy....I figured that but I didn't make it dynamic....this should help....

    Please Login or Register  to view this content.

    EDIT: You/I Should also DIM all the variables....including x

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Extract Numerical part with VB Code

    Hello Judgeh59:

    Yes this works great.
    Would you mind helping on one of my existing unsolved thread which is related to this.
    Would appreciate if you can.

    http://www.excelforum.com/excel-prog...rage-data.html

    Please Let me Know if you have any questions.
    Thanks.
    Riz

+ 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. [SOLVED] Formula needed to extract numbers from alpha numerical entry please
    By Twaddy006 in forum Excel Formulas & Functions
    Replies: 19
    Last Post: 01-14-2014, 05:26 PM
  2. [SOLVED] Extract a numerical value after a text.
    By Ken64 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-24-2013, 02:30 PM
  3. Replies: 2
    Last Post: 03-09-2013, 04:30 AM
  4. Part Code + part no combination for list box
    By suhas_shah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2006, 07:28 PM
  5. Extract one numerical value from single cell with multiple values?
    By cszy67 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-26-2005, 09:49 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