Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50117

[SOLVED] VBA Code - Expand/Collapse Grouped Columns

$
0
0
Hello all,

Currently, Columns EFG are grouped.

I have a userform with checkboxes. With the click of check box, i would like for it to do the following.

If checked, it will expand the group. If unchchcked, it needs to stay collapsed.

Here is an example of code i currently have and is not working.
Code:

If CheckBox1.Value = True Then Worksheets(ActiveSheet.Name).Columns("e,f,g").Cells = expand
If CheckBox1.Value = false Then Worksheets(ActiveSheet.Name).Columns("e").Cells = collapse

any help will be much appreciated

Viewing all articles
Browse latest Browse all 50117