Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Can't read optionbutton values

Hello all,

I'm trying to read the boolean value of 50 option buttons into column A of a
worksheet so that column A will be, for example
TRUE
FALSE
TRUE
TRUE
.. . . . etc. The following routine does not work, but I don't know why (I
get a runtime error 438):

Sub test()
For i = 1 To 50
Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet1").OLEObjects
_("Optionbutton" & i).Value
Next i
End Sub

Later on, I'll want to read the boolean values in column a to change the
value properties of option buttons 1 through 50.

Can anyone help me with this?

Thanks!

Jeff


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Can't read optionbutton values

Jeff,

Needs "Object"...

Worksheets("Sheet1").Cells(i, 1).Value = _
Worksheets("Sheet1").OLEObjects("OptionButton" &i).Object.Value

Also, unless the buttons are separated into groups,
there can only be one option button with a value of True.
All others are false when any one is True.

Jim Cone
San Francisco, USA



"Jeff Wright" wrote in message
news:JFVge.40816$_K.23846@fed1read03...
Hello all,

I'm trying to read the boolean value of 50 option buttons into column A of a
worksheet so that column A will be, for example
TRUE
FALSE
TRUE
TRUE
. . . . etc. The following routine does not work, but I don't know why (I
get a runtime error 438):

Sub test()
For i = 1 To 50
Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet1").OLEObjects
_("Optionbutton" & i).Value
Next i
End Sub

Later on, I'll want to read the boolean values in column a to change the
value properties of option buttons 1 through 50.

Can anyone help me with this?

Thanks!

Jeff


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can't read optionbutton values

Just to add
Remember this:

For i = 2 to 82 Step 2
Sheets("Data").OleObjects("OptionButton" _
& i).Object.value = true
Next i

to go the other way.

Sub test1()
For i = 1 To 50
Worksheets("Sheet1").OLEObjects("Optionbutton" )
& i).Object.Value = Worksheets("Sheet1").Cells(i, 1).Value
Next i
End Sub


--
Regards,
Tom Ogilvy


"Jeff Wright" wrote in message
news:JFVge.40816$_K.23846@fed1read03...
Hello all,

I'm trying to read the boolean value of 50 option buttons into column A of

a
worksheet so that column A will be, for example
TRUE
FALSE
TRUE
TRUE
. . . . etc. The following routine does not work, but I don't know why

(I
get a runtime error 438):

Sub test()
For i = 1 To 50
Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet1").OLEObjects
_("Optionbutton" & i).Value
Next i
End Sub

Later on, I'll want to read the boolean values in column a to change the
value properties of option buttons 1 through 50.

Can anyone help me with this?

Thanks!

Jeff




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Can't read optionbutton values

Thanks, Jim! This did the trick. Your help is truly appreciated.

Sincerely,

Jeff Wright



"Jim Cone" wrote in message
...
Jeff,

Needs "Object"...

Worksheets("Sheet1").Cells(i, 1).Value = _
Worksheets("Sheet1").OLEObjects("OptionButton" &i).Object.Value

Also, unless the buttons are separated into groups,
there can only be one option button with a value of True.
All others are false when any one is True.

Jim Cone
San Francisco, USA



"Jeff Wright" wrote in message
news:JFVge.40816$_K.23846@fed1read03...
Hello all,

I'm trying to read the boolean value of 50 option buttons into column A
of a
worksheet so that column A will be, for example
TRUE
FALSE
TRUE
TRUE
. . . . etc. The following routine does not work, but I don't know why
(I
get a runtime error 438):

Sub test()
For i = 1 To 50
Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet1").OLEObjects
_("Optionbutton" & i).Value
Next i
End Sub

Later on, I'll want to read the boolean values in column a to change the
value properties of option buttons 1 through 50.

Can anyone help me with this?

Thanks!

Jeff




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Can't read optionbutton values

Tom, thanks again for you help. Your answer (and Jim's answer, too) has
really helped with my work project. This group (with people like you, Jim,
and many others) has proven to be an invaluable resource for me. Many times
I wonder where I'd be without it.

Thanks again,

Jeff Wright


"Tom Ogilvy" wrote in message
...
Just to add
Remember this:

For i = 2 to 82 Step 2
Sheets("Data").OleObjects("OptionButton" _
& i).Object.value = true
Next i

to go the other way.

Sub test1()
For i = 1 To 50
Worksheets("Sheet1").OLEObjects("Optionbutton" )
& i).Object.Value = Worksheets("Sheet1").Cells(i, 1).Value
Next i
End Sub


--
Regards,
Tom Ogilvy


"Jeff Wright" wrote in message
news:JFVge.40816$_K.23846@fed1read03...
Hello all,

I'm trying to read the boolean value of 50 option buttons into column A
of

a
worksheet so that column A will be, for example
TRUE
FALSE
TRUE
TRUE
. . . . etc. The following routine does not work, but I don't know why

(I
get a runtime error 438):

Sub test()
For i = 1 To 50
Worksheets("Sheet1").Cells(i, 1) = Worksheets("Sheet1").OLEObjects
_("Optionbutton" & i).Value
Next i
End Sub

Later on, I'll want to read the boolean values in column a to change the
value properties of option buttons 1 through 50.

Can anyone help me with this?

Thanks!

Jeff






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
Values?? Please Read Below. CHR1S New Users to Excel 2 August 18th 09 10:28 PM
Read Excel row values shantanu Excel Worksheet Functions 4 November 28th 07 08:03 AM
read the values from a excel row shantanu Excel Worksheet Functions 2 July 13th 07 09:22 AM
Read series values range of a chart matelot Charts and Charting in Excel 2 May 15th 07 03:45 AM
How do I read values from a line chart? Lynn Charts and Charting in Excel 3 October 9th 05 09:11 PM


All times are GMT +1. The time now is 06:16 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"