PC Review


Reply
Thread Tools Rate Thread

Check Box Help

 
 
kthompson20
Guest
Posts: n/a
 
      3rd Oct 2008
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.
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      3rd Oct 2008
You have the wrong type of check box. There are 2 possible chackboxes that
you can insert. The one form the forms toolbar is the one that you have. You
want the one from the Control Toolbox. Grab one of those and all should be
well in your world...
--
HTH...

Jim Thomlinson


"kthompson20" wrote:

> 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.

 
Reply With Quote
 
kthompson20
Guest
Posts: n/a
 
      3rd Oct 2008
I'm not quite sure what you mean by the Control Toolbox. The only options I
see to get the checkbox from is Form Controls or Active X Controls. Could
you please be more specific where I can find the Control Toolbox?

Thanks for your help.

"Jim Thomlinson" wrote:

> You have the wrong type of check box. There are 2 possible chackboxes that
> you can insert. The one form the forms toolbar is the one that you have. You
> want the one from the Control Toolbox. Grab one of those and all should be
> well in your world...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "kthompson20" wrote:
>
> > 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.

 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      3rd Oct 2008
The Control Toolbox is a menu. Select Tools -> Customize -> Toolbars tab and
check off Control Toolbox. As a guess you already have the forms toolbar
selected.
--
HTH...

Jim Thomlinson


"kthompson20" wrote:

> I'm not quite sure what you mean by the Control Toolbox. The only options I
> see to get the checkbox from is Form Controls or Active X Controls. Could
> you please be more specific where I can find the Control Toolbox?
>
> Thanks for your help.
>
> "Jim Thomlinson" wrote:
>
> > You have the wrong type of check box. There are 2 possible chackboxes that
> > you can insert. The one form the forms toolbar is the one that you have. You
> > want the one from the Control Toolbox. Grab one of those and all should be
> > well in your world...
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "kthompson20" wrote:
> >
> > > 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.

 
Reply With Quote
 
Jonathan Brown
Guest
Posts: n/a
 
      3rd Oct 2008
Jim,

I'm partially involved in this project with KThompson20. I know that he's
using Office Excel 2007. There isn't a menu option for Tools -> Customize ->
Toolbars tab as Office '07 has gone away from toolbars completely and are now
using the Office ribbon. Would you know where we need to go to use the
proper checkbox control in Excel '07? This would explain why he only has the
choice between a forms control checkbox or an activex control checkbox.
However; we've attempted to use both types of checkboxes and neither of them
have been working for us.

Thanks,

Jonathan

"Jim Thomlinson" wrote:

> The Control Toolbox is a menu. Select Tools -> Customize -> Toolbars tab and
> check off Control Toolbox. As a guess you already have the forms toolbar
> selected.
> --
> HTH...
>
> Jim Thomlinson
>
>
> "kthompson20" wrote:
>
> > I'm not quite sure what you mean by the Control Toolbox. The only options I
> > see to get the checkbox from is Form Controls or Active X Controls. Could
> > you please be more specific where I can find the Control Toolbox?
> >
> > Thanks for your help.
> >
> > "Jim Thomlinson" wrote:
> >
> > > You have the wrong type of check box. There are 2 possible chackboxes that
> > > you can insert. The one form the forms toolbar is the one that you have. You
> > > want the one from the Control Toolbox. Grab one of those and all should be
> > > well in your world...
> > > --
> > > HTH...
> > >
> > > Jim Thomlinson
> > >
> > >
> > > "kthompson20" wrote:
> > >
> > > > 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell check -- text marked skip spelling and grammar check =?Utf-8?B?RGF2aWQgQS4=?= Microsoft Word Document Management 8 9th Aug 2008 11:47 PM
Asp.net Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft C# .NET 1 9th Oct 2007 02:25 PM
Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft ASP .NET 1 9th Oct 2007 02:25 PM
In outlook get message "Spell check cannot check items...try agai =?Utf-8?B?am1yYW5jaG1hbg==?= Microsoft Outlook Discussion 1 28th Sep 2006 10:26 PM
Xp:Check Disk:Tools:Check Now:Both Options:reboot countdown does not complete? RAS Windows XP General 3 1st Feb 2005 06:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:44 PM.