Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Simple CHeck box to view/hide rows

Hi Shelly -

Your code works fine, but needs to be associated with the checkbox's 'click'
event (so the very act of clicking the checkbox triggers your code). You do
this by inserting your code into a Click event procedure that resides in the
module of the worksheet that the checkbox is in. The best way to do that is:

1. Enter Design Mode (show the Control Toolbox and choose [Design Mode].

2. Right-click the checkbox and choose [View Code]. The worksheet module
opens automatically and types a Click-event procedure template as follows:

Private Sub Risk_Box_Click()
End Sub

3. Insert your code between these two lines.

-------
Alternatively, you could copy this slightly modified version into the
worksheet module. Again, yours works just fine, but this one is a bit more
compact:

Private Sub Risk_Box_Click()
If Risk_Box.Value = 0 Then
Rows("6:9").EntireRow.Hidden = True
Else
Rows("6:9").EntireRow.Hidden = False
End If
End Sub

--
Jay


"Shelly" wrote:

I'm trying to create checkbox where if it's checked rows 6-9 show, if it's
unchecked they are hidden. I've go the follow, but I must be missing
something...

--------------------------


Private Sub Risk_Box()
Application.ScreenUpdating = False
If Risk_Box.Value = 0 Then
Range("A6:A9").EntireRow.Hidden = True
Else
If Risk_Box.Value < 0 Then
Range("A6:A9").EntireRow.Hidden = False
End If
End If
Application.ScreenUpdating = True
End Sub

---------------------------

Thanks for the help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Simple CHeck box to view/hide rows

Hi Shelly -

Good to hear that you're making progress. Here is a link to address your
missing libraries or references problem. Fixing it is frequently easier than
you'd think, given the cryptic error message.

http://www.cpearson.com/excel/StartupErrors.htm

For your particular error, focus first on Step 9. In VBA, go to
|Tools|References...| and scan the list for any entries that are stamped with
"MISSING". If you find one, and it is not one of the 4 essentials outlined
in Step 9, then uncheck it. Exit and restart Excel and see if that cures
your problem. Deeper troubleshooting steps are described in the other steps.
--
Jay


"Shelly" wrote:

Thanks, Jay. I was able to finally figure out what was wrong. Excel on my
computer is dying. It's giving me an error that libraries or references are
missing. Ugh. I'm taken my workbook to another computer - and am back at
it again.

THANKS!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Simple CHeck box to view/hide rows

Thanks, Jay. I was able to finally figure out what was wrong. Excel on my
computer is dying. It's giving me an error that libraries or references are
missing. Ugh. I'm taken my workbook to another computer - and am back at
it again.

THANKS!

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 & Show Rows based on Check Boxes loza Excel Discussion (Misc queries) 1 September 14th 08 01:49 AM
How to hide negative value view (eg: #######) Dags Excel Discussion (Misc queries) 2 July 16th 07 08:46 AM
Is there a simple procedure to hide rows if a condition is met fishingengineer Excel Discussion (Misc queries) 1 April 13th 07 08:26 PM
simple code hide/show rows with cell = empty, set value or any val ivory_kitten Excel Programming 4 July 18th 06 02:27 AM
Automate display/ hide rows in excel based on yes/no check box schraplau Excel Discussion (Misc queries) 0 April 25th 06 07:48 PM


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