Greg Determann
New Member
- Joined
- Jan 18, 2005
- Messages
- 20
I am new at using VBA and only have limited knowledge of macros. I want to add several check boxes that will hide/unhide rows on another worksheet. Any ideas. Thanks in advance.
pennysaver said:Welcome to the Board!
The following code is for ActiveX CheckBoxes from the Control Toolbox; the code goes in the sheet specific module. If you double-click a control while in Edit mode, you'll be taken to the appropriate VBA module.
<font face=Tahoma><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CheckBox1_Click()
<SPAN style="color:#00007F">If</SPAN> CheckBox1.Value = <SPAN style="color:#00007F">True</SPAN> <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#007F00">' Hide a row when checked</SPAN>
Sheets("Sheet2").Range("A1").EntireRow.Hidden = <SPAN style="color:#00007F">True</SPAN>
<SPAN style="color:#00007F">Else</SPAN>
<SPAN style="color:#007F00">' Unhide when unchecked</SPAN>
Sheets("Sheet2").Range("A1").EntireRow.Hidden = <SPAN style="color:#00007F">False</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
Hope that helps,
Smitty