|
|
- Sub ykcbf() '//2025.11.3
- r = Cells(Rows.Count, 1).End(xlUp).Row
- For i = 2 To r
- txt = Cells(i, 1).Value
- Set reg = CreateObject("VBScript.RegExp")
- reg.IgnoreCase = True
- reg.Global = False
- reg.Pattern = "^\s*\d+[.、]\s*(.*?)([0-9]+(?:\s*元)?)\s*$"
- If reg.Test(txt) Then
- Set matches = reg.Execute(txt)
- namePart = Trim(matches(0).SubMatches(0))
- amountPart = Trim(matches(0).SubMatches(1))
- Cells(i, 3).Value = namePart
- Cells(i, 4).Value = amountPart
- Else
- reg.Pattern = "^\s*\d+[.、]\s*(.*)$"
- If reg.Test(txt) Then
- Set matches = reg.Execute(txt)
- namePart = Trim(matches(0).SubMatches(0))
- Cells(i, 3).Value = namePart
- End If
- End If
- Next
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|