Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a sheet with a very long list of items in Column A, which may ormay
not have figures in the columns to the right. Since the list is so long, I'd really like to only see those rows in which an item iin the first column does have non-zero figures to the right. I can do this manually, I know, but this sheet updates and is printed daily, and it would save a LOT of time and paper if I could program it so that the rows would hide whenever there are all zeroes to the right. I'd think I should be able to do something in VBA so tha rows conditionally hide when--to use row 2 as an example-- cells B2:Z2 = 0. Is this possible? Thanks for any help anyone can offer. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If B2 thru Z2 are all zero, then the sum(B2:Z2) will be zero:
Sub pbj() Dim r As Range Set r = ActiveSheet.UsedRange n = nLastRow + r.Rows.Count + r.Row - 1 For i = 1 To n s = "B" & i & ":" & "Z" & i Set r = Range(s) If Application.WorksheetFunction.Sum(r) = 0 Then r.EntireRow.Hidden = True End If Next End Sub -- Gary's Student gsnu200706 "PBJ" wrote: I have a sheet with a very long list of items in Column A, which may ormay not have figures in the columns to the right. Since the list is so long, I'd really like to only see those rows in which an item iin the first column does have non-zero figures to the right. I can do this manually, I know, but this sheet updates and is printed daily, and it would save a LOT of time and paper if I could program it so that the rows would hide whenever there are all zeroes to the right. I'd think I should be able to do something in VBA so tha rows conditionally hide when--to use row 2 as an example-- cells B2:Z2 = 0. Is this possible? Thanks for any help anyone can offer. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I use conditional formatting to hide or delete rows? | Excel Worksheet Functions | |||
Conditional Formatting to Hide Rows or Columns? | Excel Discussion (Misc queries) | |||
Hide Rows - copy and paste only rows that show | Excel Worksheet Functions | |||
Conditional Hide/Unhide Rows | Excel Discussion (Misc queries) | |||
CAN I HIDE ROWS WITH CONDITIONAL FORMATTING? | Excel Discussion (Misc queries) |