View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
-JEFF-[_2_] -JEFF-[_2_] is offline
external usenet poster
 
Posts: 26
Default Are all properties of controls on ctrl toolbox toolbar accessa

Yes it was the name of the very first button. When I tested I did not have
the name change portion rem'd out and the name got changed. I am going to
persue the "For each OptionButton in ActiveSheet.OLEobjects" loop for
efficiency which will also eliminate that prob and allow me to run over the
entire sheet even if the buttons have been previously changed.
Thank you very much for all of your time and efforts!
-JEFF-

"Tom Ogilvy" wrote:

I ran this 15 times with nary a problem:

Sub BBCC()
For iob = 1 To 10
ActiveSheet.OLEObjects("OptionButton" & iob) _
.LinkedCell = "'" & ActiveSheet.Name & "'!P" & 10 + iob

Next

End Sub

See my other comment on a changed name.

--
Regards,
Tom Ogilvy

"-JEFF-" wrote in message
...
Using Excel 2000 9.0.6926. It seems funny that it ran one time and now I

get
the error. I've tried your latest code and my latest efficient code and I
always get the error.

"Tom Ogilvy" wrote:

the code I posted is correct as an example.

However, if you are running it in a loop, I wouldn't think you would

want to
link all optionbuttons to a single cell as that code would indiciate.

for iob = 1 to 10
ActiveSheet.OLEObjects("OptionButton" & iob) _
.LinkedCell = "'" & Activesheet.Name & "'!P11"
end if
Next
would probably be more like

for iob = 1 to 10
ActiveSheet.OLEObjects("OptionButton" & iob) _
.LinkedCell = "'" & Activesheet.Name & "'!P" & 10 + iob
end if
Next

I am not sure why you would get an error - possibly if the focus is not

on
the sheet.

Are you using xl97?

--
Regards,
Tom Ogilvy

"-JEFF-" wrote in message
...
Now I feel like I'm being a PITB, but the code ran one time, now I am
getting
the error "Unable to get the OLEobjects property of the worksheet

class"
Any
ideas?
-JEFF-

"Tom Ogilvy" wrote:

The linked cell property is provided by the container of the
OptionButton.
You access it like this;
ActiveSheet.OLEObjects("OptionButton" & iob) _
.LinkedCell = "'" & Activesheet.Name & "'!P11"


--
Regards,
Tom Ogilvy


"-JEFF-" wrote in message
...
Using the OptionButton from the controls toolbox toolbar, I am

unable
to
access the linkedcell property using the following code. I have
accessed
some of the properties, (caption, value) using this syntax but

when I
try
to
change LinkedCell, I get "object doesn't support this property or
method"
How do I change the linkedcell property?

ActiveSheet.OLEObjects("OptionButton" & iob).Object.LinkedCell =

"P11"