Nothing on TV so here goes. This gives results such as:
ParseIT("R0101R01") = 0101
ParseIT("R010R01") = 010
etc...
If the pattern is find first occurrence of a string of numbers within a
string then:
Public Function ParseIT(y)
Const strNumbers As String = "0123456789"
Dim strIN As String
Dim strTMP As String
Dim a As String
Dim zLen As Long
Dim iCounter As Long
Dim jCounter As Long
Dim blnFlag As Boolean
On Error GoTo TrapIt
If Len(Nz(y)) = 0 Then 'nothing to do
Exit Function
Else
strIN = y
zLen = Len(strIN)
End If
strTMP = ""
blnFlag = False
For iCounter = 1 To zLen
a = Mid(strIN, iCounter, 1)
If InStr(strNumbers, a) > 0 Then 'found first occurrence of number
strTMP = a
If iCounter = zLen Then 'rare case than only number is at end
Exit For
End If
For jCounter = iCounter + 1 To zLen 'run to end of string
a = Mid(strIN, jCounter, 1)
If InStr(strNumbers, a) > 0 Then
strTMP = strTMP & a
Else 'bail out if we find another alpha
blnFlag = True
Exit For
End If
Next jCounter
End If
If blnFlag Then Exit For
Next iCounter
ParseIT = strTMP
EnterHere:
Exit Function
TrapIt:
MsgBox Err.Number & vbCrLf & Err.Description
Resume EnterHere
End Function