ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   hide/unhide (https://www.excelbanter.com/excel-discussion-misc-queries/129445-hide-unhide.html)

brownti

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...


Dave F

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...



brownti

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...



Dave F

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...





All times are GMT +1. The time now is 05:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com