Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm stilll really struggling with my checkboxes!
How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked
cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I think you may have solved the problem for me - thank you!
I will now go and see if it will work on multiple sheets with a number of checkboxes. "Toppers" wrote: I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Min
another way to hide an individual column. Creat a list of the cols to hide, say on a new sheet. I used COls E to H On the sheet you want to operate add a combo box, I linked it to A1. then I assigned this macro. Sub HideCol() c = Range("A1") + 3 Columns(c).EntireColumn.Hidden = Not Columns(c).EntireColumn.Hidden End Sub Maybe this will help another time Peter |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Can I also add into the macro something that will make an option button true
when the checkbox is true, and vice versa? "Toppers" wrote: I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Link the Option Button to the same cell as the Checkbox .. no other macro
required. The Checkbox will set the state of the Option button. HTH "Min" wrote: Can I also add into the macro something that will make an option button true when the checkbox is true, and vice versa? "Toppers" wrote: I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Yes, this works. Thank you. But...
I have 6 checkboxes that hide or unhide different columns. I also have an option button to 'show all'. If the user selects all 6 checkboxes then I want the option button to be true, otherwise it remains false. Similarly, if the user selects the option button then I want all 6 checkboxes to be true. Is this possible? "Toppers" wrote: Link the Option Button to the same cell as the Checkbox .. no other macro required. The Checkbox will set the state of the Option button. HTH "Min" wrote: Can I also add into the macro something that will make an option button true when the checkbox is true, and vice versa? "Toppers" wrote: I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
#8
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() If you check all 6 Checkboxes, the option button isset to TRUE and if you then uncheck one (or more) of the Check buttons, the Option button is set off. If Option button selected, all Checkboxes are selected. Is this OK? C1:H1 are link cells .for Checkboxes ... Sub Macro1() ' Check Checkboxes .... If Application.CountIf(Range("C1:H1"), "TRUE") = 6 Then Range("B1") = 1 Else Range("B1") = 0 End If End Sub B1 is link cell for Option button Sub Macro2() ' Check Option button .... If Range("B1") = 1 Then Range("C1:H1") = TRUE End If End Sub "Min" wrote: Yes, this works. Thank you. But... I have 6 checkboxes that hide or unhide different columns. I also have an option button to 'show all'. If the user selects all 6 checkboxes then I want the option button to be true, otherwise it remains false. Similarly, if the user selects the option button then I want all 6 checkboxes to be true. Is this possible? "Toppers" wrote: Link the Option Button to the same cell as the Checkbox .. no other macro required. The Checkbox will set the state of the Option button. HTH "Min" wrote: Can I also add into the macro something that will make an option button true when the checkbox is true, and vice versa? "Toppers" wrote: I placed a checkbox from the FORMS toobar on a worksheet with C1 as a linked cell: this shows TRUE/FALSE. It called the following macro in a general module which hid/unhid columns OK. Sub Macro1() Columns("C:F").EntireColumn.Hidden = Range("C1") End Sub Does this help? "Min" wrote: I'm stilll really struggling with my checkboxes! How do I write a macro that will show columns on a worksheet when the box is selected, and hide the columns again when it is deselected? Many thanks to Dave who has already tried to help, but I need simple instructions! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
checkboxes | Excel Worksheet Functions | |||
Checkboxes | Excel Discussion (Misc queries) | |||
Checkboxes and macros | Excel Discussion (Misc queries) | |||
Checkboxes | Excel Discussion (Misc queries) | |||
Checkboxes | Excel Discussion (Misc queries) |