Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
I have a string value that takes the form of ###/###.
I am looking for VBA code suggestions to isolate the numbers (as text) preceding the "/" and proceeding the "/", and then convert each to true numbers.
Both numeric values will be whole numbers, and could be of any length (value) from 1 - x digits.
Can anyone offer up a solution?
I have determined the position of the "/", and the length of the string (respectively) with this code:
Example 1:
string (from .cells(row,col)) = "32/3"
spos = 3
slen = 4
fwdnum = 32
bcknum = 3
Example 2:
string (from .cells(row,col)) = "1091/155"
spos = 5
slen = 8
fwdnum = 1091
bcknum = 155
I am looking for VBA code suggestions to isolate the numbers (as text) preceding the "/" and proceeding the "/", and then convert each to true numbers.
Both numeric values will be whole numbers, and could be of any length (value) from 1 - x digits.
Can anyone offer up a solution?
I have determined the position of the "/", and the length of the string (respectively) with this code:
Code:
spos = InStr(.Cells(srw, cl), "/")
slen = Len(.Cells(srw, cl))
Example 1:
string (from .cells(row,col)) = "32/3"
spos = 3
slen = 4
fwdnum = 32
bcknum = 3
Example 2:
string (from .cells(row,col)) = "1091/155"
spos = 5
slen = 8
fwdnum = 1091
bcknum = 155