ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hide Cells (https://www.excelbanter.com/excel-discussion-misc-queries/231673-hide-cells.html)

lightbulb

Hide Cells
 
Is there a macro or formula I can use to hide certain rows if certain cells
say "OK"?

For example, Hide any Rows between 78 and 131 when column T in those rows
equals "OK", all other rows in that range will remain visible.

Thanks!

Jarek Kujawa[_2_]

Hide Cells
 
Sub cus()

For i = 78 To 131
If Range("C" & i) = "OK" Then
Range("C" & i).Rows.EntireRow.Hidden = True
End If
Next i

End Sub


On 22 Maj, 14:39, lightbulb
wrote:
Is there a macro or formula I can use to hide certain rows if certain cells
say "OK"?

For example, Hide any Rows between 78 and 131 when column T in those rows
equals "OK", all other rows in that range will remain visible.

Thanks!



lightbulb

Hide Cells
 
I selected view code by right clicking on the tab name, and pasted in the
code below, but nothing happened...it's been awhile since I've worked with
Macros, is there something else I have to do?



"Jarek Kujawa" wrote:

Sub cus()

For i = 78 To 131
If Range("C" & i) = "OK" Then
Range("C" & i).Rows.EntireRow.Hidden = True
End If
Next i

End Sub


On 22 Maj, 14:39, lightbulb
wrote:
Is there a macro or formula I can use to hide certain rows if certain cells
say "OK"?

For example, Hide any Rows between 78 and 131 when column T in those rows
equals "OK", all other rows in that range will remain visible.

Thanks!




Jarek Kujawa[_2_]

Hide Cells
 
press ALT+F11 to get to VBA
then Insert-Module
paste the code
click Run


On 22 Maj, 16:25, lightbulb
wrote:
I selected view code by right clicking on the tab name, and pasted in the
code below, but nothing happened...it's been awhile since I've worked with
Macros, is there something else I have to do?



"Jarek Kujawa" wrote:
Sub cus()


Â* Â* For i = 78 To 131
Â* Â* Â* Â* If Range("C" & i) = "OK" Then
Â* Â* Â* Â* Â* Â* Range("C" & i).Rows.EntireRow..Hidden = True
Â* Â* Â* Â* End If
Â* Â* Next i


End Sub


On 22 Maj, 14:39, lightbulb
wrote:
Is there a macro or formula I can use to hide certain rows if certain cells
say "OK"?


For example, Hide any Rows between 78 and 131 when column T in those rows
equals "OK", all other rows in that range will remain visible.


Thanks!- Ukryj cytowany tekst -


- Pokaż cytowany tekst -




All times are GMT +1. The time now is 09:11 PM.

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