Hi Patti,
As written, your code will hide a row if ANY of the cells in columns E:H are
not bold.
Therefore, try reversing the logic:
Sub testBold()
Dim rngCell As Range
ActiveSheet.UsedRange.Rows.Hidden = True
For Each rngCell In Intersect(ActiveSheet.UsedRange, _
ActiveSheet.Columns("E:H"))
If rngCell.EntireRow.Hidden = True Then
If rngCell.Font.Bold = True Then
rngCell.EntireRow.Hidden = False
End If
End If
Next
End Sub
---
Regards,
Norman
"Patti" wrote in message
...
Hi William,
I appreciate your interest, but the code doesn't work. As I said, it
hides
_all_ of the rows on the worksheet. I tried your ammended code, and that
is
hiding all of the rows as well.
Any idea why? The cells are not bolded by conditional formatting, and if
I
select one the immediate window shows:
? activecell.font.bold
True
Patti
"William" wrote in message
...
Hi Patti
Your code works although I'd be inclined to amend it with the
following....
Sub test()
Dim rngcell As Range
Application.ScreenUpdating = False
With ActiveSheet
Intersect(.UsedRange, _
.Columns("e:h")).EntireRow.Hidden = False
For Each rngcell In Intersect(.UsedRange, _
.Columns("e:h"))
If rngcell.Font.Bold = False Then _
rngcell.EntireRow.Hidden = True
Next rngcell
End With
Application.ScreenUpdating = True
End Sub
--
XL2002
Regards
William
"Patti" wrote in message
...
| Can anyone explain to me why this doesn't work? I am trying to
filter
a
| sheet so that I am only viewing rows that have a bolded cell anywhere
in
| columns E:H. The code is hiding all rows in the worksheet.
|
| Sub test()
|
| For Each rngCell In Intersect(ActiveSheet.UsedRange,
| ActiveSheet.Columns("e:h"))
| If rngCell.Font.Bold = False Then
| rngCell.EntireRow.Hidden = True
| End If
| Next
|
| End Sub
|
| Thanks in advance.
|
|
|