返回列表 上一主題 發帖

截取A欄內最後一個數字以後的字串(結果在B欄)

try this:
  1. Sub zz()
  2. Dim ar, d As Object, rp As Object
  3. ar = Range("a2:a" & Cells(Rows.Count, 1).End(3).Row).Value
  4. With CreateObject("vbscript.regexp")
  5.     .Pattern = "\b[^\d\w]+"
  6.     For i = 1 To UBound(ar)
  7.         If .test(ar(i, 1)) Then Debug.Print .Execute(ar(i, 1))(0)
  8.     Next
  9. End With
  10. End Sub
複製代碼

TOP

        靜思自在 : 生氣,就是拿別人的過錯來懲罰自己。
返回列表 上一主題