|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub Mytest()
- Dim reg As Object, ss
- Set reg = CreateObject("vbscript.regexp")
- With reg
- .Global = True
- .Pattern = ".+/(\d+).+"
- For Each ss In Range("a2", Cells(Rows.Count, 1).End(xlUp))
- Set ss1 = .Execute(ss)
- If Left(ss.Offset(0, 1), 1) = "-" Or Left(ss.Offset(0, 1), 1) = "" Then
- ss.Offset(0, 3) = Evaluate(ss1(0).submatches(0) & ss.Offset(0, 1))
- Else
- ss.Offset(0, 3) = Evaluate(ss1(0).submatches(0) & "+" & ss.Offset(0, 1))
- End If
- Next ss
- End With
- End Sub
|
|