Hi all
I am really struggling to get this code working. It seems so simple but is giving me a headache.
I have a userform with various information that needs to be input over a period of time. At one point though a textbox will have a date put in it and this will mean that a selection of an option button must also be done. I have put 2 option buttons in a frame so that only 1 can be selected.
When the userform is submitted I want it to check if there is a value in the textbox and if so that one of the option buttons has also been selected. If they aren't then I want it to give me a msgbox to tell the user that they need to complete the option buttons.
This is the code I have:
'Private Sub CommandButton1_Click()
'
'
'
'If Me.TextBox1.Value Is Nothing And (Me.OptionButton1.Value = False _
' Or Me.OptionButton2.Value = False) Then
'
'MsgBox "Please indicate whether this initial contact was attempted or actual"
'
'End If
'
'
'Worksheets("Sheet1").Select
'
'With ActiveSheet
'
'Range("A2").Value = UserForm1.TextBox1.Value
'Range("B2").Value = UserForm1.OptionButton1.Value
'Range("C2").Value = UserForm1.OptionButton2.Value
'
'End With
'
'
'
'UserForm1.Hide
'
'End Sub
Thanks in advance.
Bookmarks