Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Hiding rows with zero sum value

I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
..EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
..Rows(i).EntireRow.Hidden = True
End If
Next i
End With


End Sub



Thanks in advance for your help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Hiding rows with zero sum value

Try:

Sub HidePurchaseZero()
Dim r As Range
On Error Resume Next
Set r = Union(Range("C92:C115"), Range("C123:C124"), Range("C132"))
r.EntireRow.Hidden = False
For Each rr In r
If WorksheetFunction.Sum(rr.EntireRow) = 0 Then
rr.EntireRow.Hidden = True
End If
Next
End Sub
--
Gary''s Student - gsnu200836


"Mike" wrote:

I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With


End Sub



Thanks in advance for your help

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Hiding rows with zero sum value

try:

With Range("C92:C115, C123, C124, C132")


On 6 Mar, 20:50, Mike wrote:
I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With

End Sub

Thanks in advance for your help


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Hiding rows with zero sum value

Thanks, unfortunately it doesn't seem to work and actually disables the
entire Macro? Any other possible suggestions?

Mike

"Gary''s Student" wrote:

Try:

Sub HidePurchaseZero()
Dim r As Range
On Error Resume Next
Set r = Union(Range("C92:C115"), Range("C123:C124"), Range("C132"))
r.EntireRow.Hidden = False
For Each rr In r
If WorksheetFunction.Sum(rr.EntireRow) = 0 Then
rr.EntireRow.Hidden = True
End If
Next
End Sub
--
Gary''s Student - gsnu200836


"Mike" wrote:

I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With


End Sub



Thanks in advance for your help

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Hiding rows with zero sum value

Hi Jerek

Thanks for trying to help, unfortunately it didn't work. For some reason, it
did not incorporate the additonal rows I needed for it to incorporate, any
other ideas?

- Mike

"Jarek Kujawa" wrote:

try:

With Range("C92:C115, C123, C124, C132")


On 6 Mar, 20:50, Mike wrote:
I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With

End Sub

Thanks in advance for your help





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Hiding rows with zero sum value

My simple tests show no problems. What are you seeing??

Try running the macro on a completely empty worksheet. The indicated rows
should loose visiblity.
--
Gary''s Student - gsnu200836


"Mike" wrote:

Thanks, unfortunately it doesn't seem to work and actually disables the
entire Macro? Any other possible suggestions?

Mike

"Gary''s Student" wrote:

Try:

Sub HidePurchaseZero()
Dim r As Range
On Error Resume Next
Set r = Union(Range("C92:C115"), Range("C123:C124"), Range("C132"))
r.EntireRow.Hidden = False
For Each rr In r
If WorksheetFunction.Sum(rr.EntireRow) = 0 Then
rr.EntireRow.Hidden = True
End If
Next
End Sub
--
Gary''s Student - gsnu200836


"Mike" wrote:

I would like to revise my Macro (below) so that I include additonal rows to
hide if the value is zero sum. I don't know how to add rows that are not
consecutive, specifically, how do I add the following rows to my Macro :
C123, C124 & C132?

Sub HidePurchaseZero()

On Error Resume Next
With Range("C92:C115")
.EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
.Rows(i).EntireRow.Hidden = True
End If
Next i
End With


End Sub



Thanks in advance for your help

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
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
Hiding Specific Rows Based on Values in Other Rows Chris Excel Worksheet Functions 1 November 2nd 06 08:21 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding Rows if the linked rows are blank KG Excel Discussion (Misc queries) 9 May 18th 05 02:32 AM
Copying Rows when hiding other rows Neutron1871 Excel Worksheet Functions 2 November 3rd 04 11:38 PM


All times are GMT +1. The time now is 12:51 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"