Hide row is no cells are bold

  • Thread starter Thread starter JustMe
  • Start date Start date
J

JustMe

How would I hide any rows in my worksheet if there is *not* a bold font in
column E,F, I or J? The bold font could appear in just one of these
columns, or in multiple.

Thanks in advance!
 
Sub HideRows()
Dim i as Long, lastrow as Long
Dim cell as Range, rng as Range
Dim bBold as Boolean
lastrow = cells(rows.count,"E").End(xlup).Row
Range("A1",Cells(lastrow,1).EntireRow.Hidden = False
for i = lastrow to 1 step -1
bBold = False
set rng = Cells(i,5).Range("A1:B1,E1:F1")
for each cell in rng
if cell.Bold then
bBold = True
exit for
end if
Next
if not bBold then
rows(i).Hidden = True
end if
Next
End Sub
 
hi tom:

do you need this:
If cell.Font.Bold Then
instead of this?
if cell.Bold then
 
Back
Top