Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Hide Columns based on checkbox values

I have a 'main' worksheet which features a series of checkboxes next to
criteria in drop down boxes. They are to show\hide columns on a sheet called
"Report"

The top line is an "all" which, when selected, marks all 12 boxes as true.
Underneath on seperate lines are the 12 other checkboxes.

I want to be able to:
1. If "all" is selected, show all columns on "Report" OR
2. Based on the value of each checkbox, show or hide the related column in
"Report"

I assume that I will have to have code similar to:
Private Sub CheckBox2_Click()
Worksheets("Report").Activate
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
End Sub

Or maybe

Private Sub CheckBox2_Click()
IF checkbox2 = True
Worksheets("Report").Activate
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
END IF
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Hide Columns based on checkbox values

You don't need to activate the sheet and you don't need to select the column.
This code will act as a toggle for hiding/showing column B in Sheet2.


With ThisWorkbook.Sheets("Sheet2").Columns("B")
.Hidden = Not .Hidden
End With



"D Zandveld" wrote:

I have a 'main' worksheet which features a series of checkboxes next to
criteria in drop down boxes. They are to show\hide columns on a sheet called
"Report"

The top line is an "all" which, when selected, marks all 12 boxes as true.
Underneath on seperate lines are the 12 other checkboxes.

I want to be able to:
1. If "all" is selected, show all columns on "Report" OR
2. Based on the value of each checkbox, show or hide the related column in
"Report"

I assume that I will have to have code similar to:
Private Sub CheckBox2_Click()
Worksheets("Report").Activate
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
End Sub

Or maybe

Private Sub CheckBox2_Click()
IF checkbox2 = True
Worksheets("Report").Activate
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
END IF
End Sub


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 Columns based on a cell value Tami Excel Worksheet Functions 10 July 16th 09 06:31 PM
Checkbox to Hide/Unhide Columns Based on Value in Cell BLarche[_3_] Excel Programming 3 September 14th 06 03:53 PM
Hide Columns Based on Condition Skornia115 Excel Programming 9 July 6th 06 04:49 PM
Hide / Unhide Columns with checkbox Sige Excel Programming 4 May 9th 05 11:43 AM
Hide a row based on values stevenmckeon Excel Programming 3 July 20th 04 01:44 AM


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