ListBox'a Veri Alma Hatası

Katılım
21 Ağustos 2005
Mesajlar
625
Excel Vers. ve Dili
Office 365 - İngilizce
Arkadaşlar merhaba, yaklaşık 1 aydır hatasız kullanmakta olduğum userform, bilgisayarın harddiski değiştikten sonra listbox'a veri almada sorun çıkartıyor. Programın bir önceki versiyonu ise doğru şekilde çalışmaya devam ediyor. Önceki versiyonda sadece tek bir userform vardı, yeni programda ilave userformlar ekledim ama userform1 de hiç bir değişiklik yapılmadı. İşin içinden çıkamadım, gözden kaçırdığım bir şey mi var acaba? Uzman gözüyle bakarsanız memnun olurum. Şimdiden teşekkürler.

Hata Mesajı:
Run-time error '-2147352571 (80020005)
Could not set the List property. Type mismatch.


Kodlar aşağıdadır.
Kod:
Private Sub cmdCivil_Click()
Dim x, y As String
cmdCivil.BackColor = &HC0C0FF
cmdMech.BackColor = &H8000000F
cmdElec.BackColor = &H8000000F
cmdAll.BackColor = &H8000000F
cmdOther.BackColor = &H8000000F
If CheckBox1.Value = True Then
x = "YES"
GoTo 10
End If

If CheckBox2.Value = True Then
y = "NO"
GoTo 20
End If

10
ListBox1.Clear
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "120;40;470;40;40"

son = [a50000].End(xlUp).Row
a = 0
For i = 1 To son
If Cells(i, 8) = x And Cells(i, 5) = "CIVIL" Then
ListBox1.AddItem
ListBox1.List(a, 0) = Cells(i, 1) 'HATANIN ALINDIĞI SATIR
ListBox1.List(a, 1) = Cells(i, 2)
ListBox1.List(a, 2) = Cells(i, 3)
ListBox1.List(a, 3) = Cells(i, 5)
ListBox1.List(a, 4) = Cells(i, 8)
a = a + 1
End If
Next i
Label6.Caption = a
Label3.Caption = "Total Civil Item:"
Label7.Caption = ""
Label1.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label8.Caption = ""
Label9.Caption = ""
Label10.Caption = ""
Label11.Caption = ""
Exit Sub
20
ListBox1.Clear
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "120;40;470;40;40"
son = [a50000].End(xlUp).Row
a = 0
For j = 1 To son
If Cells(j, 8) = y And Cells(j, 5) = "CIVIL" Then
ListBox1.AddItem
ListBox1.List(a, 0) = Cells(j, 1) 'HATANIN ALINDIĞI SATIR
ListBox1.List(a, 1) = Cells(j, 2)
ListBox1.List(a, 2) = Cells(j, 3)
ListBox1.List(a, 3) = Cells(j, 5)
ListBox1.List(a, 4) = Cells(j, 8)
a = a + 1
End If
Next j
Label6.Caption = a
Label3.Caption = "Total Civil Item:"
Label7.Caption = ""
Label1.Caption = ""
Label4.Caption = ""
Label5.Caption = ""
Label8.Caption = ""
Label9.Caption = ""
Label10.Caption = ""
Label11.Caption = ""
End Sub
 
Üst