S
StephanieH
I seem to be having a problem with a simple If.. Then statement.
I have the following:
Private Sub OK_Click()
If ListBox1.ListIndex = 0 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\ADU Chargeoffs.xls"
If ListBox1.ListIndex = 1 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Agency Chargeoffs.xls"
If ListBox1.ListIndex = 2 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Attorney Chargeoffs.xls"
If ListBox1.ListIndex = 3 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Deceased Chargeoffs.xls"
If ListBox1.ListIndex = 4 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Internal Chargeoffs.xls"
If ListBox1.ListIndex = 5 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Large Balance Chargeoffs.xls"
Unload UserForm1
End Sub
I'm getting the message "Block If without End if". I've tried adding "End
if" between "Unload UserForm1" and End Sub, but that's not working. It's a
multiselect ListBox so if I add End If between the ListIndexes it only opens
the last file selected.
Help...
I have the following:
Private Sub OK_Click()
If ListBox1.ListIndex = 0 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\ADU Chargeoffs.xls"
If ListBox1.ListIndex = 1 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Agency Chargeoffs.xls"
If ListBox1.ListIndex = 2 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Attorney Chargeoffs.xls"
If ListBox1.ListIndex = 3 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Deceased Chargeoffs.xls"
If ListBox1.ListIndex = 4 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Internal Chargeoffs.xls"
If ListBox1.ListIndex = 5 Then
ChDir "\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Chargeoff
Trends"
Workbooks.Open Filename:= _
"\\Fl-aejf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery
MIS\Chargeoff Trends\Large Balance Chargeoffs.xls"
Unload UserForm1
End Sub
I'm getting the message "Block If without End if". I've tried adding "End
if" between "Unload UserForm1" and End Sub, but that's not working. It's a
multiselect ListBox so if I add End If between the ListIndexes it only opens
the last file selected.
Help...