返回列表 上一主題 發帖

[發問] 如何在單元格抽取特定的文字?

回復 1# leehom
模組中增加自訂函數
  1. Function GetSerialNumber(s As String) As String
  2.     Dim oMatch As Object
  3.     With CreateObject("vbscript.regexp")
  4.         '假設規則為 4個大寫英文+7個數字 的獨立單詞
  5.         .Pattern = "\b[A-Z]{4}[0-9]{7}\b"
  6.         Set oMatch = .Execute(s)
  7.     End With
  8.     If oMatch.Count > 0 Then GetSerialNumber = oMatch(0)
  9. End Function
複製代碼
B1填入 =GetSerialNumber(A1)
表達不清、題意不明確、沒附檔案格式、沒有討論問題的態度~~~~~~以上愛莫能助。

TOP

        靜思自在 : 唯其尊重自己的人,才更勇於縮小自己。
返回列表 上一主題