Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to hide all rows that have a cell value of "complete"
Hello all, I wonder if it is possible to create a macro that would toggle
rows from hidden to unhidden? I would like the button to hide all rows that have a particular cell as "complete". If this requires 2 seperate buttons that is not a problem. I think i may need to have a range in for the row (A1 to M1 for example) as i have some data already hidden beyond M1 (used in drop down lists). any help would be much appreciated. thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to hide all rows that have a cell value of "complete"
hi Tom, i think i can just hide the whole row?
I thought that if i did a hide command on that row then did unhide; the data that is hidden on the far right of the sheet (used in drop down lists). But it seems that these hidden lists are not affected. I have tried your code, but i am unsure if i am applying it correctly? I have pasted it into VBA editor and then created a macro button and assigned it to the button. When i click the macro button nothing appears to happen. Where am i going wrong? Sorry as you can see i am very novice :-( "Tom Ogilvy" wrote: A2 to Q2 is a single row??? Maybe you meant hide columns although it seems unlikely: Sub CommandButton1_Click() Dim c As Range For Each c In ActiveSheet.Range("A2:Q2") If c.Value = "Complete" Then With c.EntireColumn .Hidden = Not .Hidden End With End If Next c End Sub Please clarify what you want. -- Regards, Tom Ogilvy "Maax" wrote: Hi Vergel, many thanks for your reply. However i can not make it work. i want each row to be hidden in this range A2 to Q2 i entered your code using the VBA option and assigned it to a button but its not doing anything? "Vergel Adriano" wrote: As an example, the following code will hide/unhide rows where the cell in column A has "Complete" Sub toggle_hidden_rows() Dim c As Range For Each c In ActiveSheet.Range("A1:A100") If c.Value = "Complete" Then With c.EntireRow .Hidden = Not .Hidden End With End If Next c End Sub -- Hope that helps. Vergel Adriano "Maax" wrote: Hello all, I wonder if it is possible to create a macro that would toggle rows from hidden to unhidden? I would like the button to hide all rows that have a particular cell as "complete". If this requires 2 seperate buttons that is not a problem. I think i may need to have a range in for the row (A1 to M1 for example) as i have some data already hidden beyond M1 (used in drop down lists). any help would be much appreciated. thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
"Print titles must be contiguos and complete rows or columns?" | Excel Discussion (Misc queries) | |||
macro to hide all rows that have a cell value of "complete" | Excel Programming | |||
macro to hide all rows that have a cell value of "complete" | Excel Programming | |||
Using Macro to hide rows that have a "0" quantity value | Excel Programming |