ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro to hide a row when a cell contains a value (https://www.excelbanter.com/excel-worksheet-functions/210671-macro-hide-row-when-cell-contains-value.html)

InfoNeeded

macro to hide a row when a cell contains a value
 
I have an excel sheet that contains multiple rows. I want to be able to
hide/unhide the rows that contain "C" (complete) when there is a "C" in
column P when I click on the command button that contains the macro

Gary''s Student

macro to hide a row when a cell contains a value
 
Sub HideMe()
n = Cells(Rows.Count, "P").End(xlUp).Row
For i = 1 To n
If Cells(i, "P").Value = "C" Then
Rows(i).EntireRow.Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200814


"InfoNeeded" wrote:

I have an excel sheet that contains multiple rows. I want to be able to
hide/unhide the rows that contain "C" (complete) when there is a "C" in
column P when I click on the command button that contains the macro



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

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