ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hide rows with specific contents (https://www.excelbanter.com/excel-programming/329211-hide-rows-specific-contents.html)

Dennis Cheung[_2_]

hide rows with specific contents
 
i need to hide rows if a cell's content is aa or bb or cc. these contents
are located in column A.
can i do it by a marco?

dennis



Alok

hide rows with specific contents
 
Use code like the following
Sub HideRows()
Dim r&
for r = 1 to Sheet1.UsedRange.Rows.Count
select case Sheet1.cells(r,1).value
Case "aa","bb","cc"
Sheet1.Rows(r).Hidden=true
Case Else
Sheet1.Rows(r).Hidden=false
end select
Next r
End Sub

"Dennis Cheung" wrote:

i need to hide rows if a cell's content is aa or bb or cc. these contents
are located in column A.
can i do it by a marco?

dennis




Dennis Cheung[_2_]

hide rows with specific contents
 
thanks, it helps.

"Alok" wrote in message
...
Use code like the following
Sub HideRows()
Dim r&
for r = 1 to Sheet1.UsedRange.Rows.Count
select case Sheet1.cells(r,1).value
Case "aa","bb","cc"
Sheet1.Rows(r).Hidden=true
Case Else
Sheet1.Rows(r).Hidden=false
end select
Next r
End Sub

"Dennis Cheung" wrote:

i need to hide rows if a cell's content is aa or bb or cc. these contents
are located in column A.
can i do it by a marco?

dennis







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

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