PDA

View Full Version : Solved: Radio button is not working - variable not defined



doctortt
04-16-2011, 06:40 PM
I keep on getting 'Variable not defined' on Button3 when i execute my codes. What seems to be the problem? I already made sure the *name* properties of the button on the worksheet is set to Button3.

If Button3.Value = True Then
MsgBox "TESTING"
End If

Simon Lloyd
04-16-2011, 06:47 PM
Is the button off the forms toolbox or the controls toolbox?
Please supply any code you are working with in relation to this button as that should be fine if you have the button called Button3, but default is OptionButton3

doctortt
04-16-2011, 07:00 PM
Is the button off the forms toolbox or the controls toolbox?
Please supply any code you are working with in relation to this button as that should be fine if you have the button called Button3, but default is OptionButton3

It's from the control tool box.

I have a button on the worksheet that links the actual codes of the entire VBA program. If a user click this button, the program will run. So the program codes are stored in under the 'Modules' folder.

I then created another radio button on the worksheet.

Codes are like.

Do
blahblahblah
Loop Until X = 12345

If button3.value = true then
do this
end if

Msgbox ("values are " & blabhalbah)

doctortt
04-16-2011, 07:21 PM
Oh I figured it out.

The original button with all the program codes is in Form, and my radio button is in Active X.

I rebuilt the original button in Active X mode and button3.value works now.

If button3.value = true then
do this
end if