I need help with a project,
I have a Userform that I am using as an alternative to the Sort and Autosort options on a Worksheet. The reason I am using a UserForm is because the Worksheet needs to be protected from any unintentional removal of data.
The UserForm has 8 option buttons, a Label for the Combobox and the Combobox. The Label Caption is populated by whatever Option Button is selected and from that choice is where the Combobox ListFillRange is loaded.
The code I have right now is giving me a Run-time error 424: Object required when any of the Option Button's are selected.
Here is the code I have adopted
UserForm Module - Userform name is FRM_Sort
Standard Module to call the CMBO_Change events --- (This is where the error messages are being generated from)
I have a Userform that I am using as an alternative to the Sort and Autosort options on a Worksheet. The reason I am using a UserForm is because the Worksheet needs to be protected from any unintentional removal of data.
The UserForm has 8 option buttons, a Label for the Combobox and the Combobox. The Label Caption is populated by whatever Option Button is selected and from that choice is where the Combobox ListFillRange is loaded.
The code I have right now is giving me a Run-time error 424: Object required when any of the Option Button's are selected.
Here is the code I have adopted
UserForm Module - Userform name is FRM_Sort
Code:
Private Sub UserForm_Initialize()
CMBO_Criteria = ""
End Sub
Private Sub CMD_Cancel_Click()
Me.Hide
End Sub
Private Sub OB_Note_Date_Click()
LBL_Label.Caption = OB_Note_Date.Caption
CMBO_Change (1)
End Sub
Private Sub OB_Res_Click()
LBL_Label.Caption = OB_Res.Caption
CMBO_Change (2)
End Sub
Private Sub OB_FPS_Click()
LBL_Label.Caption = OB_FPS.Caption
CMBO_Change (3)
End Sub
Private Sub OB_Adate_Click()
LBL_Label.Caption = OB_Adate.Caption
CMBO_Change (4)
End Sub
Private Sub OB_Stat_Click()
LBL_Label.Caption = OB_Stat.Caption
CMBO_Change (5)
End Sub
Private Sub OB_Rdate_Click()
LBL_Label.Caption = OB_Rdate.Caption
CMBO_Change (6)
End Sub
Private Sub OB_Note_Click()
LBL_Label.Caption = OB_Note.Caption
CMBO_Change (7)
End Sub
Private Sub OB_Officer_Click()
LBL_Label.Caption = OB_Officer.Caption
CMBO_Change (8)
End Sub
Standard Module to call the CMBO_Change events --- (This is where the error messages are being generated from)
Code:
Sub CMBO_Change(myOption As Long)
Dim Limit As Long
Select Case myOption
Case 1
Limit = Sheets("NOTES").Cells(Rows.Count, 2).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!B3:B" & Limit
Case 2
Limit = Sheets("NOTES").Cells(Rows.Count, 3).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!C3:C" & Limit
Case 3
Limit = Sheets("NOTES").Cells(Rows.Count, 4).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!D3:D" & Limit
Case 4
Limit = Sheets("NOTES").Cells(Rows.Count, 5).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!E3:E" & Limit
Case 5
Limit = Sheets("NOTES").Cells(Rows.Count, 6).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!F3:F" & Limit
Case 6
Limit = Sheets("NOTES").Cells(Rows.Count, 7).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!G3:G" & Limit
Case 7
Limit = Sheets("NOTES").Cells(Rows.Count, 8).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!H3:H" & Limit
Case 8
Limit = Sheets("NOTES").Cells(Rows.Count, 9).End(xlUp).Row
CMBO_Criteria.ListFillRange = "NOTES!I3:I" & Limit
End Select
End Sub