
Function EstraiCodice(testo As String)
Dim regEx As New VBScript_RegExp_55.RegExp
regEx.Pattern = "[0-9]{5}"
regEx.Global = True
Set trovati = regEx.Execute(testo)
EstraiCodice = trovati(0)
End Function |
Public Sub albatros54()
Dim MyArray
Dim a As Long
Dim name As Integer
Dim rng As Range
Set rng = Range("a1:a6") '<===== nel tuo caso range("A1:A9000")
For Each cl In rng
MyArray = Split(cl.Value)
For a = LBound(MyArray) To UBound(MyArray)
nome = MyArray(a)
If Len(nome) = 5 Then
If IsNumeric(nome) Then
cl.Select
cl.Offset(0, 1) = nome
' MsgBox (nome)
End If
End If
Next
Next
End Sub |
