K
kthompson20
I'm a rookie at this Visual Basic stuff and am trying to create a simple
macro that when checking/unchecking a check box, it unhides/hides a range of
rows.
If I record the macro the easy way, then assign it to a checkbox, unchecking
will hide the rows as expected. But when I go into VB to give have it unhide
the rows when checking the box, I have problems. Here is the code I'm trying
to use:
Sub Macro1()
'
' Macro1 Macro
'
'
Rows("10:32").Select
If CheckBox1.Checked = False Then
Selection.EntireRow.Hidden = True
Else
Selection.EntireRow.Hidden = False
End If
End Sub
The error I get in the debugger is "Object Required" and the "If
CheckBox1.Checked = False Then" is highlited.
From what I understand, when I go to Properties in the developer tab, I
should get a Properties box. But I only get a Format Control box.
Also, I'm told that when I insert a check box, I should get an option for
that check box in the dropdown in VB... I only get (General) or Worksheet.
Thanks for your help.
macro that when checking/unchecking a check box, it unhides/hides a range of
rows.
If I record the macro the easy way, then assign it to a checkbox, unchecking
will hide the rows as expected. But when I go into VB to give have it unhide
the rows when checking the box, I have problems. Here is the code I'm trying
to use:
Sub Macro1()
'
' Macro1 Macro
'
'
Rows("10:32").Select
If CheckBox1.Checked = False Then
Selection.EntireRow.Hidden = True
Else
Selection.EntireRow.Hidden = False
End If
End Sub
The error I get in the debugger is "Object Required" and the "If
CheckBox1.Checked = False Then" is highlited.
From what I understand, when I go to Properties in the developer tab, I
should get a Properties box. But I only get a Format Control box.
Also, I'm told that when I insert a check box, I should get an option for
that check box in the dropdown in VB... I only get (General) or Worksheet.
Thanks for your help.