By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,321 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,321 IT Pros & Developers. It's quick & easy.

How to create a checkbox subgroup in excel 2007?

P: n/a
I have a list of level 1 checkboxes and I want to add a level 2 set of checkboxes to some of them, but I only want them to show when level 1 is checked. For example, if I check the box marked "fish", I want three more boxes to appear below it that I can also check for types of fish. Below is the coding I was advised to use, but it's not working, when I click the fish box nothing happens. I'm not very familiar with VB but I have about 25 different categories I want to add multiple second level checkboxes to. Can you help me with what I'm doing wrong? Thank you!


Sub CheckBox1_Click()

End Sub

Private Sub Fish_Click()
Range("A5").EntireRow.Hidden = Not (OLEObjects("Fish").Object)
End Sub
Nov 2 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 295
You would have to use events. When you check you will need to reload the macros. So on check (in access you use me.reload) there needs to be a method where it reloads which will make the boxes appear or disappear.

Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckBox2_Click()
  2.     Application.ScreenUpdating = False
  3.     With Sheet2.CheckBox2
  4.       If .Value = True Then
  5.           Rows("30:59").EntireRow.Hidden = False
  6.       Else
  7.           Rows("30:59").EntireRow.Hidden = True
  8.       End If
  9.    End With
  11. Sheet2.Range("A1").Select
  12. End Sub
See this code I found seems to refresh data.
Nov 20 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.