I am running Excel 2007.
I am writing code and have come up against a situation that I cannot figure out. I have searched the board and cannot find a similar situation in which to draw information.
In VBA, I want to extract and keep the numerals from a string (stripping off the alpha characters). For instance, If my string is: ABC145Z. Then I want the formula (vba) to return the numeric part, 145.
I am not sure how to do this in VBA. I found a "formula" in the Excel® 2007 Bible (J. Walkenback, p.342); however, the book does not deal with VBA.
This is the formula shown in the book:
Can anyone help me with the VBA equivalent of this formula?
Thank you,
Charles
References:
John Walkenbach, (2007), Excel® 2007 Bible, Wiley Publishing, Inc., Indianapolis, Indiana 46256
I am writing code and have come up against a situation that I cannot figure out. I have searched the board and cannot find a similar situation in which to draw information.
In VBA, I want to extract and keep the numerals from a string (stripping off the alpha characters). For instance, If my string is: ABC145Z. Then I want the formula (vba) to return the numeric part, 145.
I am not sure how to do this in VBA. I found a "formula" in the Excel® 2007 Bible (J. Walkenback, p.342); however, the book does not deal with VBA.
This is the formula shown in the book:
Code:
{=MID(A1,MATCH(0,(ISERROR(MID(A1,ROW(INDIRECT
(“1:”&LEN(A1))),1)*1)*1),0),LEN(A1)-SUM((ISERROR
(MID(A1,ROW(INDIRECT(“1:”&LEN(A1))),1)*1)*1)))}
Can anyone help me with the VBA equivalent of this formula?
Thank you,
Charles
References:
John Walkenbach, (2007), Excel® 2007 Bible, Wiley Publishing, Inc., Indianapolis, Indiana 46256
Last edited: