View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Is it possible in Excel to have the result of a formula hide rows.

#1. Nope. Formulas return values to the cells that hold the formulas. They
can't do things like hide/unhide rows--or assign values to other cells.

#2. Yep.

You could put a checkbox from the Forms toolbar on your worksheet and assign it
a macro like:

Option Explicit
Sub testme()
With ActiveSheet
If .CheckBoxes(Application.Caller).Value = xlOn Then
.Range("17:23").EntireRow.Hidden = True
Else
.Range("17:23").EntireRow.Hidden = False
End If
End With
End Sub

or just a little easier to type:

Option Explicit
Sub testme()
With ActiveSheet
.Range("17:23").EntireRow.Hidden _
= CBool(.CheckBoxes(Application.Caller).Value = xlOn)
End With
End Sub

I'm not sure what "checked off" means <vbg. You may need to use xloff instead
of xlon.

Other things you could do...
Data|Filter|autofilter if there's a value in a field that can be used.

An event macro (worksheet_Calculate) that would monitor worksheet calculations
and if the criteria were met, something would happen.


NeedHelp wrote:

I was wondering if it was possible to have the result of a formula hide or
unhide rows.
Also, is it possible to use a checkbox in excel where if the box is checked
off then a row is unhidden and if the box remains unchecked a row is hidden?


--

Dave Peterson