[xpost][/xpost]
Hello brainers,
I have a VBA and this will extract all 4-digit numeric values from cell into next colums of the every row. Now I want 2 modifications in this VBA to extract 4-digit alpha value
and 4-digit alphanumeric mix value. So in fact I want three types of data extraction:
4-digit numeric (for which I have VBA below)
4-digit alpha (for which I want VBA modification)
4-digit alphanumeric (for which I want VBA modification)
Here is VBA for extraction of 4-digit numeric only value,
Code
Sub test()
Dim r As Range, i As Long
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "\b\d{4}\b"
For Each r In Range("a1", Range("a" & Rows.Count).End(xlUp))
If .test(r.Value) Then
For i = 0 To .Execute(r.Value).Count - 1
r(, i + 2).Value = .Execute(r.Value)(i)
Next
End If
Next
End With
End Sub
Display More