正規表現のコードなんですが、 上手く動きません。 何故でしょうか… Sub Test() Dim reg As Object Dim ans As Object Dim c As Range Set reg = CreateObject("VBScript.RegExp") For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp)) With reg .Pattern = "^【[(1)-(20)](\d*/\d*)" Set ans = .Execute(c.Value) End With If ans > 0 Then If Len(ans(0).submatches(0)) > 0 Then Debug.Print c.Address & "|" & ans(0).submatches(0) End If End If Next End Sub
↧