Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Run-time 438 - OptionButton troubles

I've had this trouble in various different bits of code and can't figure out
how to correct it. Here's the situation:

I've selected an item from a ListBox contained within a UserForm. The
UserForm appears on sheet "A". Once I select the item, Excel gets busy
populating a whole bunch of stuff on sheet "B". In the process it is
supposed to check to see if the value of OptionButton1 on sheet "B" is
"True". The bit of code that it has trouble with is this:
If Worksheets("B").Shapes("OptionButton1").Value = True Then
' do stuff

At first, I had "OLEObjects" in the place of "Shapes", but it didn't like
that either. How do I go about checking the value of an ActiveX control
embedded on a worksheet, regardless of whether the worksheet is active?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Run-time 438 - OptionButton troubles

I forgot to say, the error it is giving me says "Object doesn't support this
property or method".

Thanks.

"Luke" wrote:

I've had this trouble in various different bits of code and can't figure out
how to correct it. Here's the situation:

I've selected an item from a ListBox contained within a UserForm. The
UserForm appears on sheet "A". Once I select the item, Excel gets busy
populating a whole bunch of stuff on sheet "B". In the process it is
supposed to check to see if the value of OptionButton1 on sheet "B" is
"True". The bit of code that it has trouble with is this:
If Worksheets("B").Shapes("OptionButton1").Value = True Then
' do stuff

At first, I had "OLEObjects" in the place of "Shapes", but it didn't like
that either. How do I go about checking the value of an ActiveX control
embedded on a worksheet, regardless of whether the worksheet is active?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-time 438 - OptionButton troubles

I'd try:

If Worksheets("B").OptionButton1.Value = True Then

or if you want to use the OLEObjects collection:

If Worksheets("B").oleobjects("OptionButton1").object .Value = True Then



Luke wrote:

I've had this trouble in various different bits of code and can't figure out
how to correct it. Here's the situation:

I've selected an item from a ListBox contained within a UserForm. The
UserForm appears on sheet "A". Once I select the item, Excel gets busy
populating a whole bunch of stuff on sheet "B". In the process it is
supposed to check to see if the value of OptionButton1 on sheet "B" is
"True". The bit of code that it has trouble with is this:
If Worksheets("B").Shapes("OptionButton1").Value = True Then
' do stuff

At first, I had "OLEObjects" in the place of "Shapes", but it didn't like
that either. How do I go about checking the value of an ActiveX control
embedded on a worksheet, regardless of whether the worksheet is active?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Run-time 438 - OptionButton troubles

I had tried the first suggestion before, but to no avail. However, your
second suggestion worked like a charm. Thank you so much. This will save me
no end of headaches.

"Dave Peterson" wrote:

I'd try:

If Worksheets("B").OptionButton1.Value = True Then

or if you want to use the OLEObjects collection:

If Worksheets("B").oleobjects("OptionButton1").object .Value = True Then



Luke wrote:

I've had this trouble in various different bits of code and can't figure out
how to correct it. Here's the situation:

I've selected an item from a ListBox contained within a UserForm. The
UserForm appears on sheet "A". Once I select the item, Excel gets busy
populating a whole bunch of stuff on sheet "B". In the process it is
supposed to check to see if the value of OptionButton1 on sheet "B" is
"True". The bit of code that it has trouble with is this:
If Worksheets("B").Shapes("OptionButton1").Value = True Then
' do stuff

At first, I had "OLEObjects" in the place of "Shapes", but it didn't like
that either. How do I go about checking the value of an ActiveX control
embedded on a worksheet, regardless of whether the worksheet is active?


--

Dave Peterson
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-time 438 - OptionButton troubles

Both worked ok for me.


Luke wrote:

I had tried the first suggestion before, but to no avail. However, your
second suggestion worked like a charm. Thank you so much. This will save me
no end of headaches.

"Dave Peterson" wrote:

I'd try:

If Worksheets("B").OptionButton1.Value = True Then

or if you want to use the OLEObjects collection:

If Worksheets("B").oleobjects("OptionButton1").object .Value = True Then



Luke wrote:

I've had this trouble in various different bits of code and can't figure out
how to correct it. Here's the situation:

I've selected an item from a ListBox contained within a UserForm. The
UserForm appears on sheet "A". Once I select the item, Excel gets busy
populating a whole bunch of stuff on sheet "B". In the process it is
supposed to check to see if the value of OptionButton1 on sheet "B" is
"True". The bit of code that it has trouble with is this:
If Worksheets("B").Shapes("OptionButton1").Value = True Then
' do stuff

At first, I had "OLEObjects" in the place of "Shapes", but it didn't like
that either. How do I go about checking the value of an ActiveX control
embedded on a worksheet, regardless of whether the worksheet is active?


--

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
Optionbutton troubles Mats Samson Excel Worksheet Functions 2 September 27th 07 03:54 PM
for each optionbutton masterphilch Excel Programming 1 September 21st 05 05:37 PM
OptionButton nrage21[_69_] Excel Programming 1 September 29th 04 02:14 AM
Better Way to Use OptionButton [email protected] Excel Programming 0 September 1st 04 07:18 PM
Better Way to Use OptionButton [email protected] Excel Programming 4 September 1st 04 07:04 PM


All times are GMT +1. The time now is 09:05 PM.

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"