hide/unhide

B

brownti

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

Guest

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
 
B

brownti

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

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to Hide and Unhide Rows 2
Hide Unhide Buttons 3
Unhide Multiple Sheets 2
Hide Column 2
Unhide a row 1
Hide and Unhide Function 4
Unhide columns and rows 2
hide, unhide column or row after protect worksheet 4

Top