Option Button as default

G

Guest

I have the following Form set up to help others access specific files. Is
there a way to make Option Button 2 the default should user not make a
selection?

Private Sub OK_Click()
If OptionButton1 Then
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Workbooks.Open
Filename:="\\Fl-msjf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Budget\2004" & ListBox1.List(i) & "P&L.xls"
End If
Next i
Unload UserForm9
Range("A1").Select
End If

If OptionButton2 Then
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Workbooks.Open
Filename:="\\Fl-msjf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Budget\2005" & ListBox1.List(i) & "P&L.xls"
End If
Next i
Unload UserForm9
Range("A1").Select
End If
End Sub
 
G

Guest

Just set the Value property of OptionButton2 to True in design mode. Then
unless the user selects OptionButton1, the OptionButton2 will remain selected.

Alok Joshi
 
G

Guest

Perfect.


Thanks Alok.



Alok said:
Just set the Value property of OptionButton2 to True in design mode. Then
unless the user selects OptionButton1, the OptionButton2 will remain selected.

Alok Joshi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top