Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Automate Hide/Unhide Rows

Is there a way to automate hiding of rows where if A10 Rows 1 and 2 will be
hidden and if A1<1 Rows 1 and 2 will show?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Automate Hide/Unhide Rows

You can, using VBA, hide and unhide rows based upon the value in A1

How does A1 get its value? Must be a calculated return.

Your parameters look faulty to me.

0 can be < 1 and/or < 1 can be 0



Gord Dibben MS Excel MVP

On Tue, 27 Oct 2009 09:33:04 -0700, Jeremy
wrote:

Is there a way to automate hiding of rows where if A10 Rows 1 and 2 will be
hidden and if A1<1 Rows 1 and 2 will show?

Thank you


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Automate Hide/Unhide Rows

Below is the what I am trying to use. E38 realy = to another set of cells.
If I type in a number in E38 it works but if I put in a formula to have a
positive or no number it does not.


Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False' not necessary
If Not Application.Intersect(Target, Range("E38")) Is Nothing Then
Rows("36:37").Hidden = IIf(UCase(Range("E38")) <= 0, True, False) 'spelling
End If
'Application.EnableEvents = True


"Gord Dibben" wrote:

You can, using VBA, hide and unhide rows based upon the value in A1

How does A1 get its value? Must be a calculated return.

Your parameters look faulty to me.

0 can be < 1 and/or < 1 can be 0



Gord Dibben MS Excel MVP

On Tue, 27 Oct 2009 09:33:04 -0700, Jeremy
wrote:

Is there a way to automate hiding of rows where if A10 Rows 1 and 2 will be
hidden and if A1<1 Rows 1 and 2 will show?

Thank you


.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Automate Hide/Unhide Rows

If E38 contains a formula and changes because excel recalculated, then you'll
have to use the Worksheet_Calculate event.

Option Explicit
Private Sub Worksheet_Calculate()

'depending on your version of excel, this may be necessary!
Application.EnableEvents = False ' not necessary

Me.Rows("36:37").Hidden = CBool(Me.Range("E38").Value <= 0)

Application.EnableEvents = True

End Sub

xl2003 added some parameters to the =subtotal() function (=subtotal(1##,...).
The 100 level parms means that it will ignore rows hidden manually (not just by
autofilter) in the subtotal.

So hiding rows can cause excel to recalc.


Jeremy wrote:

Below is the what I am trying to use. E38 realy = to another set of cells.
If I type in a number in E38 it works but if I put in a formula to have a
positive or no number it does not.

Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False' not necessary
If Not Application.Intersect(Target, Range("E38")) Is Nothing Then
Rows("36:37").Hidden = IIf(UCase(Range("E38")) <= 0, True, False) 'spelling
End If
'Application.EnableEvents = True

"Gord Dibben" wrote:

You can, using VBA, hide and unhide rows based upon the value in A1

How does A1 get its value? Must be a calculated return.

Your parameters look faulty to me.

0 can be < 1 and/or < 1 can be 0



Gord Dibben MS Excel MVP

On Tue, 27 Oct 2009 09:33:04 -0700, Jeremy
wrote:

Is there a way to automate hiding of rows where if A10 Rows 1 and 2 will be
hidden and if A1<1 Rows 1 and 2 will show?

Thank you


.


--

Dave Peterson
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
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
How to Hide and Unhide Rows Jonno Excel Discussion (Misc queries) 2 June 9th 09 04:34 PM
Hide / Unhide columns and rows PaulM Excel Discussion (Misc queries) 8 September 6th 07 12:14 AM
Hide / UnHide - is there a Function to automate this ? Andrew Duncan Excel Worksheet Functions 8 July 5th 07 05:58 AM
Hide Unhide Rows blackstar Excel Discussion (Misc queries) 2 February 6th 06 09:36 PM


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