Option
Explicit
Sub
Test()
Call
PrintCellFormat(
"FINDFORMAT_1"
)
Call
CellSearch(
"CELLSEARCH_1"
)
With
Application.FindFormat
.Clear
With
.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End
With
End
With
Call
PrintCellFormat(
"FINDFORMAT_2"
)
Call
CellSearch(
"CELLSEARCH_2"
)
End
Sub
Private
Sub
CellSearch(
Optional
Tag)
Dim
rngResult
As
Excel.Range
Set
rngResult = Cells.Find(What:=
""
, SearchFormat:=
True
)
Debug.Print
If
Not
IsMissing(Tag)
Then
Debug.Print
"["
;
CStr
(Tag);
"]"
Debug.Print
">> Found: "
;
If
Not
rngResult
Is
Nothing
Then
Debug.Print rngResult.Address(
False
,
False
)
Else
Debug.Print
"NOTHING"
End
If
End
Sub
Private
Sub
PrintCellFormat(
Optional
Tag)
Dim
i
As
Long
With
Application.FindFormat
Debug.Print
If
Not
IsMissing(Tag)
Then
Debug.Print
"["
;
CStr
(Tag);
"]"
Debug.Print
"LineStyle"
,
"ColorIndex"
,
"TintAndShade"
,
"Weight"
For
i = 1
To
10
Debug.Print .Borders(i).LineStyle, .Borders(i).ColorIndex, .Borders(i).TintAndShade, .Borders(i).Weight
Next
End
With
End
Sub