�Z���������Ō�������iFind���\�b�h�ƈ���SearchFormat�j�bExcel VBA |
Find���\�b�h�̈���SearchFormat��True�ɂ���ƃZ���̏����������ł��܂��B�������AFindNext���\�b�h�ł͏����̌������ł��Ȃ��̂ŁA�����������ׂẴZ������������Ƃ��́A2��ڈȍ~�̌�����Find���\�b�h���g�p���܂��B
����SearchFormat��Excel 2002�ȍ~�Ŏg�p�\�ł��B
���̃T���v���́A�u�������ʁv�\�̒��Ŕw�i�F���Ԃ̃Z�����������A�ŏ��l�E�ő�l�E���v�����߂܂��B
Sub Sample()
Dim c As Range
Dim Rng As Range
Dim firstAddress As String
Application.FindFormat.Clear
Application.FindFormat.Interior.Color = vbRed
Set c = Range("��������").Find(What:="*", SearchFormat:=True)
If c Is Nothing Then
MsgBox "�Y���f�[�^�͂���܂���"
Exit Sub
Else
firstAddress = c.Address
Set Rng = c
Do
Set c = Range("��������").Find(What:="*", _
After:=c, _
SearchFormat:=True)
If c Is Nothing Then Exit Do
If c.Address = firstAddress Then Exit Do
Set Rng = Union(Rng, c)
Loop
End If
With WorksheetFunction
MsgBox "�ŏ��l�F" & .Min(Rng) & vbCrLf & _
"�ő�l�F" & .Max(Rng) & vbCrLf & _
"���v�@�F" & .Sum(Rng)
End With
End Sub
