Userform Problem

counihan3

Active Member
Joined
Mar 9, 2007
Messages
458
I am trying to have the following optionbutton value changed to false if the answer to a messanger box is no. For some reason I cannot get the value to change to false.

Code:
Private Sub CommandButton1_Click()
If OptionButton1.value = True Then
    ans = MsgBox("Are you sure that you want to delete this item?", vbYesNo, "Delete")
        If ans = vbYes Then
            Rows(fA).Delete
            Unload Me
        End If
    Exit Sub
        If ans = vbNo Then
            UserForm1.OptionButton1.value = False
        Exit Sub
    End If
End If
    Call complete
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
If you remove every Exit Sub line, it should work fine. (Assuming that fA is a public variable greater than 0.)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,040
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top