ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using Macro to Hide Rows with Certain Values (https://www.excelbanter.com/excel-discussion-misc-queries/237156-using-macro-hide-rows-certain-values.html)

Gap from Target[_2_]

Using Macro to Hide Rows with Certain Values
 
Hi:

I want to use macro to hide rows with certain values. For example, cell C7
has a value of "E- Express" and cell C8 has a value of "R- Regular". I want
to write a macro to hide rows only with "E- Express" and "R- Regular in
column "C" starting at C7 and end at C751. I don't want to this manually.



JMay

Using Macro to Hide Rows with Certain Values
 
Sub HideMyStuff()
Dim R As Range
Set R = Range("C7:C751")
For Each c In R
If c.Value = "E-Express" Or c.Value = "R-Regular" Then
c.EntireRow.Hidden = True
End If
Next c
End Sub

"Gap from Target" wrote:

Hi:

I want to use macro to hide rows with certain values. For example, cell C7
has a value of "E- Express" and cell C8 has a value of "R- Regular". I want
to write a macro to hide rows only with "E- Express" and "R- Regular in
column "C" starting at C7 and end at C751. I don't want to this manually.



Gap from Target[_2_]

Using Macro to Hide Rows with Certain Values
 
Thank-you for your assistant. I will give this a tried.

"JMay" wrote:

Sub HideMyStuff()
Dim R As Range
Set R = Range("C7:C751")
For Each c In R
If c.Value = "E-Express" Or c.Value = "R-Regular" Then
c.EntireRow.Hidden = True
End If
Next c
End Sub

"Gap from Target" wrote:

Hi:

I want to use macro to hide rows with certain values. For example, cell C7
has a value of "E- Express" and cell C8 has a value of "R- Regular". I want
to write a macro to hide rows only with "E- Express" and "R- Regular in
column "C" starting at C7 and end at C751. I don't want to this manually.




All times are GMT +1. The time now is 02:48 PM.

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