Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
is there a way to hide rows if there is a zero in certain cells.
ex A 1 12 2 0 3 11 4 3 5 0 rows 2 & 5 would hide and unhide if any number higher than 0 is entered later for those cells. The cells in column A are linked to another worksheet. |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Hi not bright
You could try this: Right-click the tab of your sheet, click View Code and paste: Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range Application.ScreenUpdating = False For Each c In Range("A2:A" & Cells.SpecialCells(xlCellTypeLastCell).Row) 'best method? If c.Value = 0 Then c.EntireRow.Hidden = True Else c.EntireRow.Hidden = False End If Next Application.ScreenUpdating = True End Sub I'm not sure if the range finder is the best for you (it finds the last row used in the entire sheet) and you may be better off substituting Range("A2:A" & Cells.SpecialCells(xlCellTypeLastCell).Row) with something like Range("A2:A100") for whatever your actual range mght be. Regards Steve |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I've used things like this before, but don't really like it because once
it's hidden you have to manually unhide the rows to change the value. On issues like this I generally try for a one-time solution. A change event doesn't give you that flexibility. -- Regards, Zack Barresse, aka firefytr To email, remove NOSPAM wrote in message oups.com... Hi not bright You could try this: Right-click the tab of your sheet, click View Code and paste: Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range Application.ScreenUpdating = False For Each c In Range("A2:A" & Cells.SpecialCells(xlCellTypeLastCell).Row) 'best method? If c.Value = 0 Then c.EntireRow.Hidden = True Else c.EntireRow.Hidden = False End If Next Application.ScreenUpdating = True End Sub I'm not sure if the range finder is the best for you (it finds the last row used in the entire sheet) and you may be better off substituting Range("A2:A" & Cells.SpecialCells(xlCellTypeLastCell).Row) with something like Range("A2:A100") for whatever your actual range mght be. Regards Steve |
#4
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
If the row is hidden when a value in the row is zero, how would you change
the zero value, which is hidden? With a macro, or is it a formula depending on data outside the hidden rows? "not bright" wrote: is there a way to hide rows if there is a zero in certain cells. ex A 1 12 2 0 3 11 4 3 5 0 rows 2 & 5 would hide and unhide if any number higher than 0 is entered later for those cells. The cells in column A are linked to another worksheet. |
#5
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
example:
sheet3 c6 has =Sheet1!C16. Sheet1 C16 has nothing in it Sheet3 Row6 would be hidden If add a number to Sheet1 C16 Sheet3 Row6 would unhide Is this possible "Patricia Shannon" wrote: If the row is hidden when a value in the row is zero, how would you change the zero value, which is hidden? With a macro, or is it a formula depending on data outside the hidden rows? "not bright" wrote: is there a way to hide rows if there is a zero in certain cells. ex A 1 12 2 0 3 11 4 3 5 0 rows 2 & 5 would hide and unhide if any number higher than 0 is entered later for those cells. The cells in column A are linked to another worksheet. |
#6
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I hoped it might be done with filters, but of course, if it were that easy,
someone with more knowledge than I would have already suggested that. Since the data that is changing is on a different sheet than the place you want to hide rows, you could do write a Worksheet_Activate macro for the worksheet you want to hide/unhide the rows on. "not bright" wrote: example: sheet3 c6 has =Sheet1!C16. Sheet1 C16 has nothing in it Sheet3 Row6 would be hidden If add a number to Sheet1 C16 Sheet3 Row6 would unhide Is this possible "Patricia Shannon" wrote: If the row is hidden when a value in the row is zero, how would you change the zero value, which is hidden? With a macro, or is it a formula depending on data outside the hidden rows? "not bright" wrote: is there a way to hide rows if there is a zero in certain cells. ex A 1 12 2 0 3 11 4 3 5 0 rows 2 & 5 would hide and unhide if any number higher than 0 is entered later for those cells. The cells in column A are linked to another worksheet. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hiding Rows if Blank cell | Excel Worksheet Functions | |||
Hiding Rows | Excel Discussion (Misc queries) | |||
Hiding Rows Leaves Labels Blank | Excel Discussion (Misc queries) | |||
2 questions one on list/combo boxes and the other on "atomically" hiding columns or rows. | New Users to Excel | |||
Hiding rows before printing | Excel Discussion (Misc queries) |