Monty
Well-Known Member
Hello Chihiro..
Really impressed with the short code provided by you.
I have few challenges which i have not noticed earlier.
Below are the challenges facing


Really impressed with the short code provided by you.
I have few challenges which i have not noticed earlier.
Below are the challenges facing


Assuming following pattern is what is needed to be extracted.
digits[dot]digits
Pattern then is "\d+\.\d+". Didn't consider negative value as sample had "-550.600" but extracted as "550.600"
Code:Sub Demo() Dim cel As Range With CreateObject("VBScript.RegExp") .Pattern = "\d+\.\d+" For Each cel In Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row) If .Test(cel.Value) Then cel.Offset(, 2) = CDbl(.Execute(cel.Value)(0)) Next End With End Sub
If not familiar with RegEx, you can use following site to test patterns.
https://regex101.com/