About MrExcel
Consulting Services
Learn Excel Resources
Challenge of the Month
MrExcel Seminars

Message Board

MrExcel Store


Mike asks "In my workbook, if a control checkbox is not checked then I would like to hide specific rows and columns automatically with VBA. How is this done?

Thank you"

Being a Control checkbox, you would have code that looks like this:

Private Sub CheckBox1_Click()
Rows(15).Hidden = CheckBox1
End Sub

The first part is to avoid an error IF you are using Excel 97. The second line is an "improved" IF, it could be made like this:

If CheckBox1 = True then
Rows(15).Hidden = True
Rows(15).Hidden = False
End If

But why do all the extra typing ?

By Juan Pablo Gonzalez on 11-Feb-2002 Consulting can be hired to implement this concept, or many other cool applications, with your data. provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.


Excel is a registered trademark of the Microsoft® Corporation.

All contents Copyright 1998-2008 by MrExcel Consulting.