1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Function SearchBold(SearchArea As Range) As Variant
Dim c As Range, firstAddress As String, count As Long
Dim myTable()
With Application.FindFormat
.Clear
.Font.Bold = True
End With
ReDim Preserve myTable(count): myTable(0) = False
With SearchArea
Set c = .Find(what:="", searchformat:=True)
Select Case True
Case Not c Is Nothing
firstAddress = c.Address: count = count + 1
ReDim Preserve myTable(count): myTable(0) = True: myTable(count) = c.Row
Case Else: SearchBold = myTable: Exit Function
End Select
'
Do
Set c = .Find(what:="", after:=c, searchformat:=True)
If Not c Is Nothing And c.Address <> firstAddress Then
count = count + 1: ReDim Preserve myTable(count): myTable(count) = c.Row
End If
Loop While Not c Is Nothing And c.Address <> firstAddress
End With
SearchBold = myTable
End Function |
Partager