Dim rng As Range
Set rng = Range(Cells(1, 2), Cells(2, 2))
'異なるシートの場合
With Worksheets("Sheet1")
.Range(.Cells(GYO1, COL1), .Cells(GYO2, COL2)).Value = 1
End With
Dim re As RegExp
Set re = New RegExp
re.Pattern = "[A-Za-z]+" 'アルファベットの連続を表す正規表現
MsgBox re.Replace("私はMikeです。", "マイク") '私はマイクです。
Executeメソッドの使用例(その1)
Dim re As RegExp
Dim mc As MatchCollection
Dim m As Match
Dim i As Integer
Set re = New RegExp
re.Pattern = "[A-Z]+" 'アルファベット(大文字)の連続を表す正規表現
re.Global = True '複数マッチを有効にする
Set mc = re.Execute("ABC DEFG HIJKL MNOPQR STUVWXY")
MsgBox "mc.Count = " & mc.Count 'mc.Count = 5
For i = 0 To mc.Count - 1
Set m = mc.Item(i)
MsgBox "FirstIndex = " & m.FirstIndex & " Length = " _
& m.Length & " Value = " & m.Value
Next i