I have userform when I search by Customer I get the run time error 380 could not set the list property, invalid property value
Here it's the code:
on debug the error highlight this line in yellow:
thank you.
Here it's the code:
Code:
Private Sub CommandButton5_Click() 'Search Button
Dim sat, s As Long
Dim deg1, deg2 As String
Sheets("ContactsInvoicing").Activate
Application.ScreenUpdating = False
If TextBox13.Value = "" Then
MsgBox "Please enter a value", vbExclamation
TextBox13.SetFocus
Exit Sub
End If
If ComboBox1.Value = "" Or ComboBox1.Value = "-" Then
MsgBox "Choose a Filter Field", vbExclamation
ComboBox1.SetFocus
Exit Sub
End If
For a = 1 To 12 ' Clear textboxes(1-12)
Controls("textbox" & a) = ""
Next
With ContactForm
.Clear
.ColumnCount = 12
.ColumnWidths = "92;140;110;65;65;35;40;65;65;115;150;65"
End With
Call Main 'Progress Bar
deg2 = TextBox13.Value
Select Case ComboBox1.Value
Case "Contact Name"
For sat = 2 To Cells(65536, "b").End(xlUp).row
Set deg1 = Cells(sat, "b")
If UCase(deg1) Like UCase(deg2) & "*" Then
ContactForm.AddItem
ContactForm.List(s, 0) = Cells(sat, "A")
ContactForm.List(s, 1) = Cells(sat, "B")
ContactForm.List(s, 2) = Cells(sat, "C")
ContactForm.List(s, 3) = Cells(sat, "D")
ContactForm.List(s, 4) = Cells(sat, "E")
ContactForm.List(s, 5) = Cells(sat, "F")
ContactForm.List(s, 6) = Cells(sat, "G")
ContactForm.List(s, 7) = Cells(sat, "H")
ContactForm.List(s, 9) = Cells(sat, "I")
ContactForm.List(s, 10) = Cells(sat, "J")
ContactForm.List(s, 11) = Cells(sat, "K")
ContactForm.List(s, 12) = Cells(sat, "L")
ContactForm.List(s, 16) = Cells(sat, "M")
ContactForm.List(s, 17) = Cells(sat, "N")
ContactForm.List(s, 18) = Cells(sat, "O")
ContactForm.List(s, 19) = Cells(sat, "P")
ContactForm.List(s, 20) = Cells(sat, "Q")
s = s + 1
End If: Next
Case "Customer"
For sat = 2 To Cells(65536, "b").End(xlUp).row
Set deg1 = Cells(sat, "a")
If UCase(deg1) Like UCase(deg2) & "*" Then
ContactForm.AddItem
ContactForm.List(s, 0) = Cells(sat, "A")
ContactForm.List(s, 1) = Cells(sat, "B")
ContactForm.List(s, 2) = Cells(sat, "C")
ContactForm.List(s, 3) = Cells(sat, "D")
ContactForm.List(s, 4) = Cells(sat, "E")
ContactForm.List(s, 5) = Cells(sat, "F")
ContactForm.List(s, 6) = Cells(sat, "G")
ContactForm.List(s, 7) = Cells(sat, "H")
ContactForm.List(s, 9) = Cells(sat, "I")
ContactForm.List(s, 10) = Cells(sat, "J")
ContactForm.List(s, 11) = Cells(sat, "K")
ContactForm.List(s, 12) = Cells(sat, "L")
ContactForm.List(s, 16) = Cells(sat, "M")
ContactForm.List(s, 17) = Cells(sat, "N")
ContactForm.List(s, 18) = Cells(sat, "O")
ContactForm.List(s, 19) = Cells(sat, "P")
ContactForm.List(s, 20) = Cells(sat, "Q")
s = s + 1
End If: Next
Case "A/C MANAGER"
For sat = 2 To Cells(65536, "l").End(xlUp).row
Set deg1 = Cells(sat, "P")
If deg1 Like deg2 & "*" Then
ContactForm.AddItem
ContactForm.List(s, 0) = Cells(sat, "A")
ContactForm.List(s, 1) = Cells(sat, "B")
ContactForm.List(s, 2) = Cells(sat, "C")
ContactForm.List(s, 3) = Cells(sat, "D")
ContactForm.List(s, 4) = Cells(sat, "E")
ContactForm.List(s, 5) = Cells(sat, "F")
ContactForm.List(s, 6) = Cells(sat, "G")
ContactForm.List(s, 7) = Cells(sat, "H")
ContactForm.List(s, 9) = Cells(sat, "I")
ContactForm.List(s, 10) = Cells(sat, "J")
ContactForm.List(s, 11) = Cells(sat, "K")
ContactForm.List(s, 12) = Cells(sat, "L")
ContactForm.List(s, 16) = Cells(sat, "M")
ContactForm.List(s, 17) = Cells(sat, "N")
ContactForm.List(s, 18) = Cells(sat, "O")
ContactForm.List(s, 19) = Cells(sat, "P")
ContactForm.List(s, 20) = Cells(sat, "Q")
s = s + 1
End If: Next
Case "City"
For sat = 2 To Cells(65536, "d").End(xlUp).row
Set deg1 = Cells(sat, "e")
If UCase(deg1) Like UCase(deg2) & "*" Then
ContactForm.AddItem
ContactForm.List(s, 0) = Cells(sat, "A")
ContactForm.List(s, 1) = Cells(sat, "B")
ContactForm.List(s, 2) = Cells(sat, "C")
ContactForm.List(s, 3) = Cells(sat, "D")
ContactForm.List(s, 4) = Cells(sat, "E")
ContactForm.List(s, 5) = Cells(sat, "F")
ContactForm.List(s, 6) = Cells(sat, "G")
ContactForm.List(s, 7) = Cells(sat, "H")
ContactForm.List(s, 9) = Cells(sat, "I")
ContactForm.List(s, 10) = Cells(sat, "J")
ContactForm.List(s, 11) = Cells(sat, "K")
ContactForm.List(s, 12) = Cells(sat, "L")
ContactForm.List(s, 16) = Cells(sat, "M")
ContactForm.List(s, 17) = Cells(sat, "N")
ContactForm.List(s, 18) = Cells(sat, "O")
ContactForm.List(s, 19) = Cells(sat, "P")
ContactForm.List(s, 20) = Cells(sat, "Q")
s = s + 1
End If: Next
Case "A/C MANAGER"
For sat = 2 To Cells(65536, "l").End(xlUp).row
Set deg1 = Cells(sat, "P")
If deg1 Like deg2 & "*" Then
ContactForm.AddItem
ontactForm.List(s, 0) = Cells(sat, "A")
ContactForm.List(s, 1) = Cells(sat, "B")
ContactForm.List(s, 2) = Cells(sat, "C")
ContactForm.List(s, 3) = Cells(sat, "D")
ContactForm.List(s, 4) = Cells(sat, "E")
ContactForm.List(s, 5) = Cells(sat, "F")
ContactForm.List(s, 6) = Cells(sat, "G")
ContactForm.List(s, 7) = Cells(sat, "H")
ContactForm.List(s, 9) = Cells(sat, "I")
ContactForm.List(s, 10) = Cells(sat, "J")
ContactForm.List(s, 11) = Cells(sat, "K")
ContactForm.List(s, 12) = Cells(sat, "L")
ContactForm.List(s, 16) = Cells(sat, "M")
ContactForm.List(s, 17) = Cells(sat, "N")
ContactForm.List(s, 18) = Cells(sat, "O")
ContactForm.List(s, 19) = Cells(sat, "P")
ContactForm.List(s, 20) = Cells(sat, "Q")
s = s + 1
End If: Next
End Select
Application.ScreenUpdating = True
Label15.Caption = ContactForm.ListCount
End Sub
Private Sub CommandButton6_Click() 'Clear Search Textbox Button
TextBox13.Value = "": ComboBox1.Value = ""
ContactForm.List = Sheets("ContactsInvoicing").Range("a2:l" & [a65536].End(3).row).Value
Label15.Caption = ""
End Sub
Private Sub CommandButton7_Click() 'Close Button
Unload Me
End Sub
on debug the error highlight this line in yellow:
Code:
ContactForm.List(s, 12) = Cells(sat, "L")
thank you.