|
发表于 2022-2-26 18:56
|
显示全部楼层
本楼为最佳答案
本帖最后由 limonet 于 2022-2-26 22:09 编辑
要求都满足
Sub test()
On Error Resume Next
Dim i%, Match, Dic As Object
Set Dic = CreateObject("scripting.dictionary")
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
Dic(Left(Cells(i, 1), 55)) = ""
Next i
Range(Cells(2, 1), Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1)).ClearContents
[A2].Resize(UBound(Dic.keys) + 1, 1) = Application.Transpose(Dic.keys)
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
With CreateObject("vbscript.regexp")
.Global = True
.MultiLine = True
.Pattern = "[0-9]{8,11}"
Cells(i, 1) = .Replace(Cells(i, 1), "12345678900")
.Pattern = "(?=售)?[0-9]{2,}\.?[0-9]{0,2}?万"
Set Match = .Execute(Cells(i, 1))
Cells(i, 2) = Match(0)
.Pattern = "[0-9]{2,}\.?[0-9]{0,2}?平?[平方]"
Set Match = .Execute(Cells(i, 1))
Cells(i, 3) = Match(0)
End With
Next i
End Sub
|
|