i have code below which all of sudden has started to come with this error
"run-time error 380: Could not set the RowSource property. Invalid property value."
when i debug it, it highlights LstCodeSearchResults.RowSource = "SearchResult" below. can some one please help identify this issue to fix it. thanks
Private Sub CmdCodesSearch_Click()
Dim RowNum As Long
Dim SearchRow As Long
RowNum = 2
SearchRow = 2
Worksheets("Refer Codes").Activate
Do Until Cells(RowNum, 1).Value = ""
If InStr(1, Cells(RowNum, 1).Value, CodesSearch.Value, vbTextCompare) Then
Worksheets("CodesSearch").Cells(SearchRow, 1).Value = Cells(RowNum, 1).Value
Worksheets("CodesSearch").Cells(SearchRow, 2).Value = Cells(RowNum, 2).Value
Worksheets("CodesSearch").Cells(SearchRow, 3).Value = Cells(RowNum, 3).Value
SearchRow = SearchRow + 1
End If
RowNum = RowNum + 1
Loop
If SearchRow = 2 Then
MsgBox "No Codes were found that match your search criteria"
Exit Sub
End If
LstCodeSearchResults.RowSource = "SearchResults"
"run-time error 380: Could not set the RowSource property. Invalid property value."
when i debug it, it highlights LstCodeSearchResults.RowSource = "SearchResult" below. can some one please help identify this issue to fix it. thanks
Private Sub CmdCodesSearch_Click()
Dim RowNum As Long
Dim SearchRow As Long
RowNum = 2
SearchRow = 2
Worksheets("Refer Codes").Activate
Do Until Cells(RowNum, 1).Value = ""
If InStr(1, Cells(RowNum, 1).Value, CodesSearch.Value, vbTextCompare) Then
Worksheets("CodesSearch").Cells(SearchRow, 1).Value = Cells(RowNum, 1).Value
Worksheets("CodesSearch").Cells(SearchRow, 2).Value = Cells(RowNum, 2).Value
Worksheets("CodesSearch").Cells(SearchRow, 3).Value = Cells(RowNum, 3).Value
SearchRow = SearchRow + 1
End If
RowNum = RowNum + 1
Loop
If SearchRow = 2 Then
MsgBox "No Codes were found that match your search criteria"
Exit Sub
End If
LstCodeSearchResults.RowSource = "SearchResults"