ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   conditional error for option button (https://www.excelbanter.com/excel-worksheet-functions/8411-conditional-error-option-button.html)

tjb

conditional error for option button
 
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?

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
....

--
Regards
Frank Kabel
Frankfurt, Germany
"tjb" schrieb im Newsbeitrag
...
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?




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!

"Frank Kabel" wrote:

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
....

--
Regards
Frank Kabel
Frankfurt, Germany
"tjb" schrieb im Newsbeitrag
...
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?





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
....

--
Regards
Frank Kabel
Frankfurt, Germany
"tjb" schrieb im Newsbeitrag
...
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!

"Frank Kabel" wrote:

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
....

--
Regards
Frank Kabel
Frankfurt, Germany
"tjb" schrieb im Newsbeitrag
...
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?








All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com