nnsea 发表于 2023-10-26 14:08:59

去编号VBA


'^ 匹配输入字符串的开始位置。
'$ 匹配输入字符串的结束位置。
Sub test()
Set regx = CreateObject("vbscript.regexp")
With regx
    .Global = True
    .Pattern = "^+\d+$"
    For Each Rng In
      Set mat = .Execute(Rng)
      For Each m In mat
      n = n + 1
      Cells(n, 2) = m
      Next
    Next
End With

End Sub
页: [1]
查看完整版本: 去编号VBA