ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide unbolded rows in specific column (https://www.excelbanter.com/excel-programming/378863-hide-unbolded-rows-specific-column.html)

Annette

Hide unbolded rows in specific column
 
How would I write the code to hide only rows that do not have bolded items
in column K ...



Bob Phillips

Hide unbolded rows in specific column
 
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)
"Annette" wrote in message
...
How would I write the code to hide only rows that do not have bolded items
in column K ...




AndrewArmstrong

Hide unbolded rows in specific column
 
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



All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com