conditional error for option button

T

tjb

When the user clicks a command button, there should be an error message if
data is in cell A1 and one of three option buttons is NOT checked. If no
data is in cell A1 then the option buttons should be ignored. Any
suggestions?
 
F

Frank Kabel

Hi
just put some code behind the click event of your command button. Something
like

......
if activesheet.range("A1").value<>"" then
if not optionbutton1.value then
msgbox "Error"
end if
end if
....
 
T

tjb

This is good except it needs to show the msgbox if there is data in A1 and
ANY one of the three option buttons aren't checked.

Right now, it's only showing the error if one specific option out of the
three isn't checked.

Thanks again Frank! You're awesome!
 
F

Frank Kabel

Hi
should be easy for you to adapt :) Do you mean:
......
if activesheet.range("A1").value<>"" then
if (not optionbutton1.value) or (not optionbutton2.value) or (not
optionbutton3.value) then
msgbox "Error"
end if
end if
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top