+ Reply to Thread
Results 1 to 2 of 2

OptionBox error checking

  1. #1
    Patrick Simonds
    Guest

    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



  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning Patrick Simmonds

    You'll kick yourself - really, you will :

    change <> for =.

    thus:

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

    HTH

    DominicB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1