Hide unbolded rows in specific column

  • Thread starter Thread starter Annette
  • Start date Start date
A

Annette

How would I write the code to hide only rows that do not have bolded items
in column K ...
 
For i = 1 To Cells(Rows.Count,"K").End(xlUp).Row
Rows(i).Hidden <> Cells(i,"K").Font.Bold
Next i

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
Sub HideNotBold()

Dim ColK As Range
'find last row of data in column k plus 1
Dim lngLastRowk As Long
lngLastRowk = Range("k65536").End(xlUp).Rows
Set ColK = Range("k1:k" & lngLastRowk + 1)

'check each cell value
For Each c In ColK
If c.Font.Bold = True Then
c.EntireRow.Hidden = True
End If
Next c
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top