Macro to hide rows based on a zero value in a particular cell
How complicated is it to create a macro to hide rows
conditioned upon a zero value in a particular column of that row? Could a second condition also be added to test for bold font type zeros to not be hidden? I have a VERY large cost estimating spreadsheet with 2,000 rows of items, and want to be able to hide rows that do not apply. Summary rows are in bold type and I would like to retain them, but hide all the detail. It takes forever manually!. |
Macro to hide rows based on a zero value in a particular cell
Just adopted something from the group. Sorry can't remember name
'make cells dispapear Sub Button1_Click() Dim cell As Range Application.ScreenUpdating = False For Each cell In Range("A1:A60") If cell.Font.Bold = False Then If cell.Value = 0 Then cell.EntireRow.Hidden = True ElseIf cell.Value < 0 Then cell.EntireRow.Hidden = False End If End If Next Application.ScreenUpdating = True End Sub 'make all cells reappear Sub Button2_Click() Dim cell As Range For Each cell In Range("A1:A60") cell.EntireRow.Hidden = False Next Application.ScreenUpdating = True End Sub "Peter" wrote in message ... How complicated is it to create a macro to hide rows conditioned upon a zero value in a particular column of that row? Could a second condition also be added to test for bold font type zeros to not be hidden? I have a VERY large cost estimating spreadsheet with 2,000 rows of items, and want to be able to hide rows that do not apply. Summary rows are in bold type and I would like to retain them, but hide all the detail. It takes forever manually!. |
Macro to hide rows based on a zero value in a particular cell
Hi Peter,
Have a look at "Outline a worksheet " and at "Group Ungroup" in help. This feature could very well do exactly what you want and would enable you to click between various hierarchical data levels revealing or hiding support data. Also, look to use the AutoFilter and Advanced Filters. --- Regards, Norman "Peter" wrote in message ... How complicated is it to create a macro to hide rows conditioned upon a zero value in a particular column of that row? Could a second condition also be added to test for bold font type zeros to not be hidden? I have a VERY large cost estimating spreadsheet with 2,000 rows of items, and want to be able to hide rows that do not apply. Summary rows are in bold type and I would like to retain them, but hide all the detail. It takes forever manually!. |
All times are GMT +1. The time now is 05:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com