ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OptionBox error checking (https://www.excelbanter.com/excel-programming/341414-optionbox-error-checking.html)

Patrick Simonds

OptionBox error checking
 
I am at a loss here. My first 5 lines of code work fine but I need code
which checks to see that If TextBox1 is not blank, and neither OptionButton4
or OptionButton5 are selected (both False) then the message box will come
telling you that you must select one or the other


If OptionButton4.Value = True Then
rng(1, 6).Value = "Yes"
ElseIf OptionButton5.Value = True Then
rng(1, 6).Value = "No"
End If

If TextBox1.Text < "" And OptionButton4.Value = False And
OptionButto5.Value = False Then
MsgBox "Input Incomplete - You must select either " & _
"Yes or No for Route 1"
GoTo EndMacro
End If



dominicb[_140_]

OptionBox error checking
 

Good morning Patrick Simmonds

You'll kick yourself - really, you will :

change < for =.

thus:

If TextBox1.Text = "" And OptionButton4.Value = False An
OptionButton5.Value = False Then

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=47166



All times are GMT +1. The time now is 12:17 AM.

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