I can have:
123123213A
5465465B
24332323232T
I need to get only the right number from string, how to?
i nedd this result:
my_var=123123213
my_var=5465465
my_var=24332323232
Note:
- in string the first digit o right string is always a letter
- the lenght of numeric part is variable (but max lenght is 14 digit)
GET right frm string
-
- Administrator
- Posts: 78545
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: GET right frm string
You can use the Val function for this:
Code: Select all
Dim strText As String
Dim my_var As String
strText = "123123123123123A"
my_var = Val(strText)
Debug.Print my_var
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: GET right frm string
i'm stupid!HansV wrote:You can use the Val function for this:
Code: Select all
Dim strText As String Dim my_var As String strText = "123123123123123A" my_var = Val(strText) Debug.Print my_var