• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Soru Combobox sorguda birebir eşleşme olsun

Katılım
12 Ocak 2009
Mesajlar
838
Excel Vers. ve Dili
2003
Altın Üyelik Bitiş Tarihi
07-02-2024
Merhaba arkadaşlar. Aağıdaki kod ile sorguda yazılan harfleri içeren tüm satırlar listeleniyor bu kodu sorgu sonucu ile birebir eşleşme ile sorgu yapsın istiyorum.
Kod:
Private Sub ComboBox1_Change()
Set sh = ActiveSheet
son = sh.Cells(65536, 2).End(xlUp).Row

ListView1.ListItems.Clear
ListView1.View = lvwReport

With ListView1
j = 1
For j = 3 To son
      If CStr(Cells(j, 2)) = CStr(ComboBox1) Or ComboBox1 = "" Or InStr(1, Cells(j, 2), ComboBox1, vbTextCompare) > 0 Then
       i = ListView1.ListItems.Count + 1
      .ListItems.Add , , CStr(j)
      .ListItems(i).SubItems(1) = Cells(j, 1)
      .ListItems(i).SubItems(2) = Cells(j, 2)
      .ListItems(i).SubItems(3) = Cells(j, 3)
      .ListItems(i).SubItems(4) = Cells(j, 4)
      .ListItems(i).SubItems(5) = Cells(j, 5)
      .ListItems(i).SubItems(6) = Cells(j, 6)
      .ListItems(i).SubItems(7) = Cells(j, 7)
      .ListItems(i).SubItems(8) = Cells(j, 8)
      .ListItems(i).SubItems(9) = Cells(j, 9)
      .ListItems(i).SubItems(10) = Cells(j, 10)
      .ListItems(i).SubItems(11) = Cells(j, 11)
      .ListItems(i).SubItems(12) = Cells(j, 12)
      .ListItems(i).SubItems(13) = Cells(j, 13)
      .ListItems(i).SubItems(14) = Cells(j, 14)
      .ListItems(i).SubItems(15) = Cells(j, 15)
      .ListItems(i).SubItems(16) = Cells(j, 16)
      .ListItems(i).SubItems(17) = Cells(j, 17)
      .ListItems(i).SubItems(18) = Cells(j, 18)
        
    
  End If
  If j Mod 1 = 0 Then
End If

Next

End With
ListView1.FullRowSelect = True
ListView1.Gridlines = True
Label53 = "Kayıt Sayısı: " & ListView1.ListItems.Count
End Sub
 

Muzaffer Ali

Destek Ekibi
Destek Ekibi
Katılım
5 Haziran 2006
Mesajlar
6,773
Excel Vers. ve Dili
2021 Türkçe
Merhaba.
Aşağıdaki satırı silin
Kod:
If CStr(Cells(j, 2)) = CStr(ComboBox1) Or ComboBox1 = "" Or InStr(1, Cells(j, 2), ComboBox1, vbTextCompare) > 0 Then
onun yerine aşağıdaki satırı ekleyin
Kod:
If CStr(Cells(j, 2)) = CStr(ComboBox1) Or ComboBox1 = "" Then
 
Üst