NEXT I之后的END IF应该放在NEXT I之前,另外EXIT SUB的IF我取消了ELSE和END IF,因为满足条件时肯定不执行后面的代码了,由于我在SUB里面编译,自己定义了一个Mee代替你的Me,目前编译没有问题,逻辑估计是你需要的:
Dim aim As Worksheet, Mee
Set aim = Sheets("RE Database")
Dim i As Integer
Dim j As Integer
If M_type.Text = "" Then Exit Sub
For i = 3 To 200
If Mee.M_level1.Text = aim.Cells(5, i) Then
For j = 5 To 100
If aim.Cells(j, i) <> "" Then
Mee.M_level1.AddItem aim.Cells(j, i)
Else
Exit For
End If
Next j
Exit For
Else
End If
Next i
Dim aim As Worksheet
Set aim = Sheets("RE Database")
Dim i As Integer
Dim j As Integer
If M_type.Text = "" Then
Exit Sub
Else
For i = 3 To 200
If Me.M_level1.Text = aim.Cells(5, i) Then
For j = 5 To 100
If aim.Cells(j, i) <> "" Then
Me.M_level1.AddItem aim.Cells(j, i)
Else
Exit For
End If
Next j
Exit For
Else
goto 100
End If
100:
Next i
end if
For j = 5 To 100
If aim.Cells(j, i) <> "" Then
Me.M_level1.AddItem aim.Cells(j, i)
Else
Exit For
End If
Next j
End If
Next i
End If
End If