Public Function ExtractNumbers(ByRef rng As Range) As Variant
Dim numCells As Long
Dim ary As Variant
Dim aryidx As Long
Dim i As Long, ii As Long
numCells = Application.Caller.Cells.Count
ReDim ary(1 To numCells)
i = 1
Do Until i > Len(rng.Value)
Do Until IsNumeric(Mid(rng.Value, i, 1)) Or i > Len(rng.Value)
i = i + 1
Loop
If i <= Len(rng.Value) Then
aryidx = aryidx + 1
ii = i + 1
Do Until (Not IsNumeric(Mid(rng.Value, ii, 1)) And Mid(rng.Value, ii, 1) <> ".") Or i >= Len(rng.Value)
ii = ii + 1
Loop
ary(aryidx) = Val(Mid(rng.Value, i, ii - i))
i = ii
End If
Loop
For i = 1 To numCells
If IsEmpty(ary(i)) Then ary(i) = ""
Next i
ExtractNumbers = ary
End Function
You need to select a number of cells alongside your string, 4, 5 or whatever, then enter the formula =ExtractNumbers(C1) as an example, as a block-array formula, that is Ctrl-Shift-Enter.