#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default hide/unhide

I am trying to create a macro that will work as follows. When a checkbox is
click, it will hide a number of cells on a different sheet. then when the
check box is unchecked, it will unhide those cells. please help...

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default hide/unhide

Here's an example of a macro which hides/unhides rows/columns:

Sub TCAPSfcst()
' Hides rows 85:159
' Hides columns AJ:CN
' Freezes window at H4
Cells.Select
Range("B1").Activate
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("85:159").Select
Selection.EntireRow.Hidden = True
Columns("AJ:CN").Select
Selection.EntireColumn.Hidden = True
Range("H4").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub


Post back if you have questions.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"brownti" wrote:

I am trying to create a macro that will work as follows. When a checkbox is
click, it will hide a number of cells on a different sheet. then when the
check box is unchecked, it will unhide those cells. please help...


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default hide/unhide

thats only hiding, but doesnt make it return when i uncheck the box...thats
what i need it to do. thanks,



Dave F wrote:
Here's an example of a macro which hides/unhides rows/columns:

Sub TCAPSfcst()
' Hides rows 85:159
' Hides columns AJ:CN
' Freezes window at H4
Cells.Select
Range("B1").Activate
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("85:159").Select
Selection.EntireRow.Hidden = True
Columns("AJ:CN").Select
Selection.EntireColumn.Hidden = True
Range("H4").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub

Post back if you have questions.

Dave
I am trying to create a macro that will work as follows. When a checkbox is
click, it will hide a number of cells on a different sheet. then when the
check box is unchecked, it will unhide those cells. please help...


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default hide/unhide

To unhide set the argument to True, for example:

change

Rows("85:159").Select
Selection.EntireRow.Hidden = True

to

Rows("85:159").Select
Selection.EntireRow.Hidden = False

Personally, I would have this triggered by a button, not a check box. Have
one button to hide what you want to hide and one button to unhide.

--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"brownti" wrote:

thats only hiding, but doesnt make it return when i uncheck the box...thats
what i need it to do. thanks,



Dave F wrote:
Here's an example of a macro which hides/unhides rows/columns:

Sub TCAPSfcst()
' Hides rows 85:159
' Hides columns AJ:CN
' Freezes window at H4
Cells.Select
Range("B1").Activate
Selection.EntireRow.Hidden = False
Selection.EntireColumn.Hidden = False
Rows("85:159").Select
Selection.EntireRow.Hidden = True
Columns("AJ:CN").Select
Selection.EntireColumn.Hidden = True
Range("H4").Select
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
End Sub

Post back if you have questions.

Dave
I am trying to create a macro that will work as follows. When a checkbox is
click, it will hide a number of cells on a different sheet. then when the
check box is unchecked, it will unhide those cells. please help...



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
How do I set up a column tool to hide/unhide? pufimic Excel Discussion (Misc queries) 1 October 27th 06 01:26 AM
Hide/unhide with data below Rachael Excel Discussion (Misc queries) 4 June 15th 06 08:51 PM
hide/unhide macro Matt Excel Discussion (Misc queries) 2 April 6th 06 07:24 PM
Conditional Hide/Unhide Rows Gwen H Excel Discussion (Misc queries) 4 March 30th 05 06:52 AM
hide/unhide cells garpavco Excel Worksheet Functions 3 January 13th 05 01:33 AM


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