PDA

View Full Version : Solved: Embedded controls



blackie42
09-17-2009, 04:14 AM
Hi

Am wondering if embedded optionbuttons can be part of a sub dependent on their state.

I have a couple on a sheet and am using the following routine

Sub query()
If OptionButton1.Enabled = True And Range("V28").Value < 0 Then
UserForm1.Show
End If
End Sub

But regardless of the value of V28 or optionbutton selected the userform still displays.

Any help appreciated
thanks

mikerickson
09-17-2009, 06:10 AM
The .Enabled property shows whether the Option button CAN be clicked. The .Value property returns whether it HAS been clicked.
If Range("V28").Value < 0 And OptionButton1.Value Then
UserForm1.Show
End If

blackie42
09-17-2009, 06:46 AM
Thanks Mike,

I think it also needs to be in the sheet code as it doesn't want to work in a stand alone module

regards
Jon