|
▼ヤムチャ さん:
一例です。
Sub Sample()
Dim myA As Range
Dim c As Range, f As Range, r As Range
Set myA = Range("A1:C20") '実際の領域に
Application.FindFormat.NumberFormatLocal = "G/標準"
Set c = myA.Find(What:="", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, MatchByte:=False, _
SearchFormat:=True)
If c Is Nothing Then
MsgBox "標準書式のセルはありません"
Else
Set f = c
Do
If r Is Nothing Then
Set r = c
Else
Set r = Union(r, c)
End If
Application.FindFormat.NumberFormatLocal = "G/標準"
Set c = myA.Find(What:="", LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, MatchByte:=False, _
SearchFormat:=True, After:=c)
Loop While c.Address <> f.Address
r.Interior.ColorIndex = 18 'Plum
End If
Set myA = Nothing
Set r = Nothing
Set c = Nothing
Set f = Nothing
End Sub
|
|