Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 477
Default Need to Use 1 Button to toggle On or Off

This works perfectly:

Sub HideZeroRows()
'to hide calculated items that equal zero
'hide worksheet rows that contain zeros
'by John Green
Dim rRow As Range
Application.ScreenUpdating = False
For Each rRow In ActiveSheet _
.PivotTables(1).DataBodyRange.Rows
If Application.Sum(rRow) = 0 Then
rRow.EntireRow.Hidden = True
End If
Next rRow
Application.ScreenUpdating = True
End Sub

There is a Macro that will **If no rows are
hidden - Run the Macro and If Rows Are hidden
UnHide All Rows. But how is this done?
Any assistance appreciated..

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Need to Use 1 Button to toggle On or Off

Include this line:

Rows.Hidden = False

It will unhide all rows
--
Gary''s Student - gsnu200759


"Jim May" wrote:

This works perfectly:

Sub HideZeroRows()
'to hide calculated items that equal zero
'hide worksheet rows that contain zeros
'by John Green
Dim rRow As Range
Application.ScreenUpdating = False
For Each rRow In ActiveSheet _
.PivotTables(1).DataBodyRange.Rows
If Application.Sum(rRow) = 0 Then
rRow.EntireRow.Hidden = True
End If
Next rRow
Application.ScreenUpdating = True
End Sub

There is a Macro that will **If no rows are
hidden - Run the Macro and If Rows Are hidden
UnHide All Rows. But how is this done?
Any assistance appreciated..

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 477
Default Need to Use 1 Button to toggle On or Off

Gary's Student : Thanks, but I do not know how to use what you are suggesting.

So far I have the following: (Which is not working) - It call my Macro

Sub HideUnHideRow() ' This is my Toggle Macro attached to a forms button
Dim bHidden As Boolean
If ActiveSheet.Cells.EntireRow.Hidden = False Then
HideZeroRows ' The Main Macro
bHidden = True
Else
ActiveSheet.Cells.EntireRow.Hidden = True
End If
bHidden = Not bHidden
End Sub


"Gary''s Student" wrote:

Include this line:

Rows.Hidden = False

It will unhide all rows
--
Gary''s Student - gsnu200759


"Jim May" wrote:

This works perfectly:

Sub HideZeroRows()
'to hide calculated items that equal zero
'hide worksheet rows that contain zeros
'by John Green
Dim rRow As Range
Application.ScreenUpdating = False
For Each rRow In ActiveSheet _
.PivotTables(1).DataBodyRange.Rows
If Application.Sum(rRow) = 0 Then
rRow.EntireRow.Hidden = True
End If
Next rRow
Application.ScreenUpdating = True
End Sub

There is a Macro that will **If no rows are
hidden - Run the Macro and If Rows Are hidden
UnHide All Rows. But how is this done?
Any assistance appreciated..

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
toggle radio button Debra Excel Discussion (Misc queries) 0 June 6th 07 07:55 PM
Toggle Button NavEx Excel Worksheet Functions 1 May 23rd 06 02:40 AM
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Toggle button keithl816 Excel Discussion (Misc queries) 2 November 21st 05 09:16 PM
Toggle Button Dave_2k5 Excel Discussion (Misc queries) 2 September 1st 05 11:27 AM


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