Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Is it possible in Excel to have the result of a formula hide rows.

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Is it possible in Excel to have the result of a formula hide rows.

hi
formulas return values, they cannot perform actions like hide and unhide rows.
but you can hide and unhide rows(and columns) with a check box. drop a check
box on the sheet from the tool box. right click the check box and click view
code.
paste this code in the code window.
Private Sub checkbox1_Click()
If Rows("10:13").Hidden = True Then
Rows("10:13").Hidden = False
checkbox1.BackColor = RGB(0, 0, 255)'change the color too
checkbox1.Caption = "hiden" 'set the captions too
Else
If Rows("10:13").Hidden = False Then
Rows("10:13").Hidden = True
checkbox1.BackColor = RGB(245, 30, 5)
checkbox1.Caption = "unhiden"
End If
End If
End Sub

set the rows to your liking. edit the check box name to what ever you set it
too.

regards
FSt1

"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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
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
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
hide rows if nil result of formula in specific column Joy Excel Discussion (Misc queries) 2 March 1st 10 02:33 AM
Hide a formula result until cell has been filled Sammy Excel Discussion (Misc queries) 13 May 19th 09 11:26 PM
Hide Rows Based on Cell Result BJ Excel Programming 2 April 14th 08 11:41 PM
Hide #VALUE! in result of array formula Ron Weaver Excel Worksheet Functions 6 January 29th 07 10:46 PM
Hide rows if formula result is zero John[_64_] Excel Programming 3 October 30th 03 05:57 PM


All times are GMT +1. The time now is 01:59 AM.

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"