Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
I am trying to write a macro that will hide a row if certain cells in that
row are all zero. I want the macro to apply to all rows in the worksheet. Can anyone help? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
Hi,
I am trying to write a macro that will hide a row if certain cells in that row are all zero Would you like to share with us which cells in a row they are? -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "jessica" wrote: I am trying to write a macro that will hide a row if certain cells in that row are all zero. I want the macro to apply to all rows in the worksheet. Can anyone help? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
Dont have a copy of Excel handy to test, but sounds like you want
something along the lines of: Sub untested() Dim myrange As Range For row = 2 to Range("A65536").End(Xlup).Row myrange = Range(Cells(row,"A"),Cells(row,"d")) If Application.WorksheetFunction.Sum(myrange) = 0 Then myrange.EntireRow.Delete Next End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
Yes, the cells are in columns F, H, J, L, N, P, R, T, V, X, and Z of each row
(10-131) on a sheet. "Mike H" wrote: Hi, I am trying to write a macro that will hide a row if certain cells in that row are all zero Would you like to share with us which cells in a row they are? -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "jessica" wrote: I am trying to write a macro that will hide a row if certain cells in that row are all zero. I want the macro to apply to all rows in the worksheet. Can anyone help? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
I tried this and received the error message "Compile error: Next without For"
"Jef Gorbach" wrote: Dont have a copy of Excel handy to test, but sounds like you want something along the lines of: Sub untested() Dim myrange As Range For row = 2 to Range("A65536").End(Xlup).Row myrange = Range(Cells(row,"A"),Cells(row,"d")) If Application.WorksheetFunction.Sum(myrange) = 0 Then myrange.EntireRow.Delete Next End Sub . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hide Rows if all values are zero
I tried this and received the error message "Compile error: Next without For"
"Jef Gorbach" wrote: Dont have a copy of Excel handy to test, but sounds like you want something along the lines of: Sub untested() Dim myrange As Range For row = 2 to Range("A65536").End(Xlup).Row myrange = Range(Cells(row,"A"),Cells(row,"d")) If Application.WorksheetFunction.Sum(myrange) = 0 Then myrange.EntireRow.Delete Next End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Macro to Hide Rows with Certain Values | Excel Discussion (Misc queries) | |||
Automatically hide rows with no values | Excel Discussion (Misc queries) | |||
How do I hide rows in a pivot table with zero values? | Excel Worksheet Functions | |||
Can anyone tell me how to hide rows that have 0 values and text. | Charts and Charting in Excel | |||
How do i hide rows in pivot table that has zero values? | Excel Discussion (Misc queries) |