It's a little hard to test with no If's, but do you mean something like this?
It's preset to False, and if there is an issue, it just exits
Only if it goes all the way does it return True
Option Explicit Sub drv() Load UserForm1 UserForm1.Show End Sub Function Apple() As Variant Apple = False If Rnd < 0.25 Then Exit Function Apple = True End Function Function Orange() As Variant Orange = False If Rnd < 0.5 Then Exit Function Orange = True End Function Function Spinach() As Variant Spinach = False If Rnd < 0.95 Then Exit Function Spinach = True End Function
Another way
Option Explicit Sub drv() Load UserForm1 UserForm1.Show End Sub Function Apple() As Variant Apple = True On Error GoTo ReturnFalse If Rnd < 0.25 Then Err.Raise 500, "Apple", "Rotten Apple" Exit Function ReturnFalse: Apple = False End Function Function Orange() As Variant Orange = True On Error GoTo ReturnFalse If Rnd < 0.5 Then Err.Raise 501, "Orange", "Rotten Orange" Exit Function ReturnFalse: Orange = False End Function Function Spinach() As Variant Spinach = True On Error GoTo ReturnFalse If Rnd < 0.75 Then Err.Raise 502, "Spinach", "Rotten Spinach" Exit Function ReturnFalse: Spinach = False End Function




Reply With Quote