Excel/Check Boxes to Hide Columns
Good Afternoon Jan I hope you are well.
This is a 2 part question really.
What I am trying to do is, I have a workbook with 2 sheets, “Details” and “Gangs Works”.
In sheet “Details” I have people’s names, these are hyperlinks to the respective name on “Gangs Work” sheet and vice-versa.
I have at the moment, placed CheckBoxes beside the Names in the Details sheet.
What I would like is if the check box beside name IS checked, the related column on the “Gangs Work” sheet would be UnHidden and IF the check box is NOT checked the related column on the “Gangs Work” sheet would be Hidden.
This is only a very small file for this demo.
Is there an easy / quick way to create and code (at the moment) around 80 check boxes.
You may have a better solution to achive the same..
Here is a link to a demo file… http://1drv.ms/SAAqlD
Add this code to a normal module and assign each checkbox to it:
Dim sName As String
Dim oCell As Range
Dim bCheck As Boolean
Dim lCT As Long
For lCT = 1 To Worksheets("Details").CheckBoxes.Count
If Worksheets("Details").CheckBoxes(lCT).Name = Application.Caller Then
bCheck = Worksheets("Details").CheckBoxes(lCT).Value = 1
Set oCell = Worksheets("Details").CheckBoxes(lCT).TopLeftCell.Offset(, -1)
ActiveCell.EntireColumn.Hidden = Not bCheck
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here