Convert String to Numeric Values

J

JenISCM

I have data string that I must convert to numeric values.

Ex:
00100200300400500600700800901000110015016

How do I get the above data string example to return the numeric values that
are three digit integers.

How do I get the number 16 for example?

Any assistance is appreciated
 
R

raskew via AccessMonster.com

Try this:

Public Sub MySplit(txtIn As String)
' copy/paste to a standard module
' input from debug window:
' call mysplit("00100200300400500600700800901000110015016")

Dim i As Integer
Dim n As Integer

i = 1
For n = 1 To CInt(Len(txtIn) / 3)
Debug.Print n & " - " & val(Mid(txtIn, i, 3))
i = i + 3
Next n
End Sub

Bob
 
J

John W. Vinson

I have data string that I must convert to numeric values.

Ex:
00100200300400500600700800901000110015016

How do I get the above data string example to return the numeric values that
are three digit integers.

How do I get the number 16 for example?

Any assistance is appreciated

How long is a string? will it always be 48 characters long, or is it variable?

Val(Mid([string], 3*([Which number:] - 1), 3))

will prompt you for which substring you want and return the value in that
substring, if that helps you.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top