Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple hiding columns with vba does not work with a checkbox
Hello,
I am a little confused by something that should be very simple. I am trying to have certain columns hide and unhide depending on if a check box is check or not checked. I get an error that says: "Run-time error 1004" "Unable to set the Hidden Property of the Range class" What confuses me most is the following works when placed in a subroutine but not when placed in a checkbox's change function. So this works: Sub test() Columns("A:B").Hidden = Not Columns("A:B").Hidden End Sub And this doesn't: Private Sub CheckBox1_Click() Columns("A:B").Hidden = Not Columns("A:B").Hidden End Sub This is all on a blank new workbook with nothing else to get in the way and I am using Excel 97. The worksheet is not protected and I get the same results when there is data in the cells and when there is no date in the cells. I have also tried included more specific references with workbooks(). and worksheets(). but that doesn't help either. Any help would be much appreciated as I am about to head butt my computer. Thanks, Brian |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I insert simple checkbox which can be checked by a click? | Excel Discussion (Misc queries) | |||
Inserting a simple checkbox that can be checked | Excel Discussion (Misc queries) | |||
Hiding a ComboBox with a Checkbox | Excel Worksheet Functions | |||
Simple Checkbox Message Code | Excel Discussion (Misc queries) | |||
I need to create a simple checkbox that has true false outputs | Excel Discussion (Misc queries) |