|
Sub 提取()
Set reg = CreateObject("vbscript.regexp")
reg.ignorecase = True
With Sheets(1)
k = .Cells(65536, 2).End(xlUp).Row
For i = 1 To 182
reg.Pattern = "^\s*.*?([^/]*?°[^/]*).*|^[一-龡]+/([^/]+/)?([\.\d]+([m-z][hf])?)/.*"
If reg.test(.Cells(i, 2)) Then
.Cells(i, 3) = "'" & reg.Replace(.Cells(i, 2), "$1$3")
Else
reg.Pattern = "^\s*.*?((?=[^/]*?[a-z])([^\(/一-龡]*\d+[^\(/一-龡]*)+).*"
.Cells(i, 3) = reg.Replace(.Cells(i, 2), "$1")
End If
Next i
For j = 183 To k
If Len(.Cells(j, 4)) > 0 Then
arr = Split(.Cells(j, 4), "/")
For i = 0 To 1
If InStr(.Cells(j, 2), arr(i)) = 0 Then GoTo l1
Next i
.Cells(j, 3) = arr(0)
l1:
End If
Next j
End With
End Sub
|
|