Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referencing checkboxes on a worksheet from a form

Hi,

I am trying to figure out how to reference some checkboxes directly placed
on a worksheet from code attached to a form. In other words, I want to click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some checkboxes
on a form, and then new checkboxes will be automatically created on the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Referencing checkboxes on a worksheet from a form

Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1", Link:=False, _
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75, Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly placed
on a worksheet from code attached to a form. In other words, I want to

click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some

checkboxes
on a form, and then new checkboxes will be automatically created on the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referencing checkboxes on a worksheet from a form

Hi Nick,

both parts of your answer were extremely useful to me. Thank you very much
indeed!!

Best regards,
Brian.



"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1", Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want to

click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some

checkboxes
on a form, and then new checkboxes will be automatically created on the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referencing checkboxes on a worksheet from a form

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.


"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1", Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want to

click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some

checkboxes
on a form, and then new checkboxes will be automatically created on the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing checkboxes on a worksheet from a form

Watch your double quotes!

..OLEObjects("CheckBox10").Delete



Brian wrote:

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.

"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1", Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want to

click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some

checkboxes
on a form, and then new checkboxes will be automatically created on the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.





--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referencing checkboxes on a worksheet from a form

Hi Dave,

thanks for the reminder. I did actually have the double quotes there
originally and received the same error. I kept trying new things, one of
them being removing the double quotes. I forgot to put the quotes back when
I posted in the newsgroup.

I am trying to figure out a different way of going about what I am trying to
achieve. A little more reading is required I think.

Best regards,
Brian.


"Dave Peterson" wrote in message
...
Watch your double quotes!

.OLEObjects("CheckBox10").Delete



Brian wrote:

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to
delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.

"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a
check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want to
click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some
checkboxes
on a form, and then new checkboxes will be automatically created on
the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.





--

Dave Peterson



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing checkboxes on a worksheet from a form

If you go back to excel and go into design mode (on that same control toolbox
toolbar) and then rightclick on the checkbox you want to delete, what's the name
that shows up in the namebox (to the left of the formula bar)?

Try using that.

And you're sure you used a checkbox from the Control toolbox toolbar--not
checkboxes from the Forms toolbar, right?????

Brian wrote:

Hi Dave,

thanks for the reminder. I did actually have the double quotes there
originally and received the same error. I kept trying new things, one of
them being removing the double quotes. I forgot to put the quotes back when
I posted in the newsgroup.

I am trying to figure out a different way of going about what I am trying to
achieve. A little more reading is required I think.

Best regards,
Brian.

"Dave Peterson" wrote in message
...
Watch your double quotes!

.OLEObjects("CheckBox10").Delete



Brian wrote:

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to
delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.

"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a
check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want to
click
a button on a form and tell it to remove some checkboxes on sheet. To
clarify that...yes I do want to "remove" the checkboxes, not simply to
uncheck them.

A second question: is there any way to allow a user to tick some
checkboxes
on a form, and then new checkboxes will be automatically created on
the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.





--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Referencing checkboxes on a worksheet from a form

Hi Dave,

If you are curious/interested at all as to what I am trying to achieve - I
have placed my test file on my webspace.
My document is at http://www.members.optusnet.com.au/cooloox/Newsgroups/ .

I have placed notes on the first worksheet setting out what the macro is
intended to do.

Best regards,
Brian.


"Dave Peterson" wrote in message
...
If you go back to excel and go into design mode (on that same control
toolbox
toolbar) and then rightclick on the checkbox you want to delete, what's
the name
that shows up in the namebox (to the left of the formula bar)?

Try using that.

And you're sure you used a checkbox from the Control toolbox toolbar--not
checkboxes from the Forms toolbar, right?????

Brian wrote:

Hi Dave,

thanks for the reminder. I did actually have the double quotes there
originally and received the same error. I kept trying new things, one of
them being removing the double quotes. I forgot to put the quotes back
when
I posted in the newsgroup.

I am trying to figure out a different way of going about what I am trying
to
achieve. A little more reading is required I think.

Best regards,
Brian.

"Dave Peterson" wrote in message
...
Watch your double quotes!

.OLEObjects("CheckBox10").Delete



Brian wrote:

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to
delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.

"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a
check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want
to
click
a button on a form and tell it to remove some checkboxes on sheet.
To
clarify that...yes I do want to "remove" the checkboxes, not simply
to
uncheck them.

A second question: is there any way to allow a user to tick some
checkboxes
on a form, and then new checkboxes will be automatically created on
the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.





--

Dave Peterson


--

Dave Peterson



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referencing checkboxes on a worksheet from a form

I don't like opening other people's workbooks--especially when they contain
macros.

I'm not sure if you solved your problem, though.

Brian wrote:

Hi Dave,

If you are curious/interested at all as to what I am trying to achieve - I
have placed my test file on my webspace.
My document is at http://www.members.optusnet.com.au/cooloox/Newsgroups/ .

I have placed notes on the first worksheet setting out what the macro is
intended to do.

Best regards,
Brian.

"Dave Peterson" wrote in message
...
If you go back to excel and go into design mode (on that same control
toolbox
toolbar) and then rightclick on the checkbox you want to delete, what's
the name
that shows up in the namebox (to the left of the formula bar)?

Try using that.

And you're sure you used a checkbox from the Control toolbox toolbar--not
checkboxes from the Forms toolbar, right?????

Brian wrote:

Hi Dave,

thanks for the reminder. I did actually have the double quotes there
originally and received the same error. I kept trying new things, one of
them being removing the double quotes. I forgot to put the quotes back
when
I posted in the newsgroup.

I am trying to figure out a different way of going about what I am trying
to
achieve. A little more reading is required I think.

Best regards,
Brian.

"Dave Peterson" wrote in message
...
Watch your double quotes!

.OLEObjects("CheckBox10").Delete



Brian wrote:

Hi again Nick,

I spoke a little too soon, I looked at your reply and it looked very
straight forward and logical. However, when I try to use the code to
delete
a checkbox I get the following error:

Run-time error '1004':
Unable to get the OLEObjects property of the worksheets class, and it
highlights the following line: .OLEObjects(CheckBox10).Delete

I do have a Checkbox10 by the way. I am not sure what that means.

Best regards,
Brian.

"NickHK" wrote in message
...
Brian,
Like this ?

Private Sub CommandButton1_Click()
With Worksheets(1)
.OLEObjects("CheckBox1").Delete
End With
End Sub

For the 2nd part, record a macro whilst you add a check box to get
something
like:

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Check Box.1",
Link:=False,
_
DisplayAsIcon:=False, Left:=373.5, Top:=165.75, Width:=63.75,
Height
_
:=20.25).Select

Combine this with the _Click event of your existing Checkbox.
Presumable you would need to delete it also if the check box is then
unchecked, otherwise the user will become confused; or do not use a
check
box for this action.

NickHK

"Brian" wrote in message
...
Hi,

I am trying to figure out how to reference some checkboxes directly
placed
on a worksheet from code attached to a form. In other words, I want
to
click
a button on a form and tell it to remove some checkboxes on sheet.
To
clarify that...yes I do want to "remove" the checkboxes, not simply
to
uncheck them.

A second question: is there any way to allow a user to tick some
checkboxes
on a form, and then new checkboxes will be automatically created on
the
worksheet for those ticked items only?

I am new to VBA. Any help would be most appreciated.

Best regards,
Brian.





--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a cell in the worksheet as the criteria for a form Alagra Excel Worksheet Functions 2 October 26th 09 05:26 PM
uncheck checkboxes from a form Bob Phillips Excel Programming 1 January 8th 07 01:08 AM
User Form with CheckBoxes Paige Excel Programming 4 August 23rd 06 07:15 PM
REFERENCING WORKSHEET CELL FROM VISUAL FOXPRO FORM Alan Excel Discussion (Misc queries) 0 July 7th 06 08:05 AM
Adding Checkboxes to a Form Bill[_30_] Excel Programming 3 June 26th 06 11:57 PM


All times are GMT +1. The time now is 09:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"