Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Macro to Hide Rows with Certain Values Gap from Target[_2_] Excel Discussion (Misc queries) 2 July 17th 09 12:57 PM
Automatically hide rows with no values Momof2 Excel Discussion (Misc queries) 1 September 19th 08 12:25 AM
How do I hide rows in a pivot table with zero values? fs Excel Worksheet Functions 0 May 22nd 06 09:10 PM
Can anyone tell me how to hide rows that have 0 values and text. Aussie Charts and Charting in Excel 2 April 13th 06 10:57 AM
How do i hide rows in pivot table that has zero values? SHIAN Excel Discussion (Misc queries) 0 November 2nd 05 04:18 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"