Использую код для поиска ячеек с форматом "bold". Пример взял из книги Уокенбаха но он чето зависает. Может кто знает в чем проблема.
With Application.FindFormat
.Clear
.Font.Bold = True
End With
Set FirstCell = Selection.Find(What:="", SearchFormat:=True)
If FirstCell Is Nothing Then
MsgBox "Ячейка с таким форматирование не найдена"
Exit Sub
End If
Set AllCells = FirstCell
Set FoundCell = FirstCell
Do
Set FoundCell = Selection.FindNext(After:=FoundCell)
Set AllCells = Application.Union(AllCells, FoundCell)
'MsgBox AllCells.Address
If FoundCell.Address = FirstCell.Address Then Exit Do
Loop
AllCells.Select
With Application.FindFormat
.Clear
.Font.Bold = True
End With
Set FirstCell = Selection.Find(What:="", SearchFormat:=True)
If FirstCell Is Nothing Then
MsgBox "Ячейка с таким форматирование не найдена"
Exit Sub
End If
Set AllCells = FirstCell
Set FoundCell = FirstCell
Do
Set FoundCell = Selection.FindNext(After:=FoundCell)
Set AllCells = Application.Union(AllCells, FoundCell)
'MsgBox AllCells.Address
If FoundCell.Address = FirstCell.Address Then Exit Do
Loop
AllCells.Select