View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
mathel mathel is offline
external usenet poster
 
Posts: 64
Default UserForm Option Button

Thank you. Removing the space ( If Range("A3") ="" then) has helped and will
invoke the MsgBox. Now I am getting an error code on "UserForm1.SetFocus".
Reading through other Posts I saw Option Buttons should be grouped. I
grouped them and under the Group Properties name them 'Source'. I then
changed the last line in the code to read: 'Source.SetFocus' .......

This is where I get Error 424. I hope you can help, I have no idea what I
am doing at this point!
Thanks
--
Linda


"Per Jessen" wrote:

Linda,

You are not testing if A3 is empty, but if it has a single space
character.

Try this (no space between the quotation signs):

If Range("A3") ="" then

Regards,
Per

On 6 Apr., 20:18, mathel wrote:
I am new to UserForms (Excel 2003). I created a UserForm with 3 options that
input data into Cell A3 in a worksheet. However, you can exit the Userform
by clicking 'OK' without selecting any of the options. I need at least one
Option to be selected. I thought the following Code would help, but doesn't.
I am hoping someone can help.

Private Sub OK_Click()

If Range("A3") = " " Then
MsgBox "You Must Select the Source from this menu"
UserForm1.SetFocus

Exit Sub
End If

Unload Me

End Sub

Thanks
Linda