+ Reply to Thread
Results 1 to 4 of 4

VBA User defined function to find position of last number in a cell

  1. #1
    Registered User
    Join Date
    09-15-2015
    Location
    Denmark
    MS-Off Ver
    office365
    Posts
    5

    VBA User defined function to find position of last number in a cell

    Hi

    I have a cell (Let just say A1) which include both numbers and text. For example:

    12x24Z

    I want a user defined function, which give me the position of the last number in that cell. In this case the position for number 4 (position = 5).

    I think I find a solution with the standard Excel functions, but it is a little heavy So I thought I could so something smart by creating a user defined function in VBA, but so far I only have:



    Function FindNum() as long

    dim i as long

    FindNum = 0



    and nothing more. I am blank. Any ideas?

    Thank you so much.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: VBA User defined function to find position of last number in a cell

    Maybe this.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: VBA User defined function to find position of last number in a cell

    One way using formula:
    Please Login or Register  to view this content.
    Hope its not too heavy.
    If you still need an UDF, I'll come back.
    Quang PT

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: VBA User defined function to find position of last number in a cell

    Quote Originally Posted by excee View Post
    but so far I only have:

    Function FindNum() as long

    dim i as long

    FindNum = 0



    and nothing more. I am blank. Any ideas?
    Please Login or Register  to view this content.

+ 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. The user defined function to find any special character
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-19-2019, 08:12 AM
  2. Use my own user-defined function to analyse numbers in a cell
    By timsah in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-18-2017, 03:19 PM
  3. Please help - function to find first digit in a user-defined range
    By alexchan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2016, 11:49 PM
  4. duplicate user-defined function for cell
    By bluphoto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2014, 01:31 PM
  5. Help with a User Defined Lookup function--To concatenate and find all instances
    By samueldips in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 12:08 PM
  6. [SOLVED] Color a result cell in a user defined function
    By aaa in forum Excel General
    Replies: 1
    Last Post: 05-08-2006, 11:25 AM
  7. [SOLVED] user defined function row number
    By bj in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-09-2005, 10:06 AM

Tags for this Thread

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