• DİKKAT

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

combobox mükerrer kayıt

Katılım
15 Ocak 2013
Mesajlar
85
Excel Vers. ve Dili
2007 türkçe
Set s = Sheets("Urunler")
For i = 2 To s.Range("b65536").End(3).Row
If WorksheetFunction.CountIf(s.Range("b2:b" & i), s.Cells(i, "b")) = 1 Then
modelCombo.AddItem s.Cells(i, "b").Value
End If
Next

Arkadaşlar yukarıdaki kod ile mükerrer kayıtları kaldırarak verileri teke indirebiliyorum
alttaki blokta nasıl bir uyarlama yapmam lazım ki modelCombo daki değere göre urunlerdeki mükerrer kayıtları da teke indirebileyim

Set s = Sheets("Urunler")
urunCombo.Clear
For X = 2 To s.Range("b65536").End(3).Row
If s.Cells(X, 2).Value = modelCombo.Value Then
' If WorksheetFunction.CountIf(s.Range("c2:c" & i), s.Cells(i, "c")) = 1 Then
urunCombo.AddItem s.Cells(X, 3).Value
End If
Next
urunCombo.ListIndex = 0
End Sub
 
Çokeğersay kullanarak kodu güncelledim.
Kod:
Private Sub modelCombo_Change()
Set s = Sheets("Urunler")
urunCombo.Clear
    For i = 2 To s.Range("b65536").End(3).Row
        If s.Cells(i, 2).Value = modelCombo.Value Then
            If WorksheetFunction.CountIfs(s.Range("b2:b" & i), s.Cells(i, "b"), s.Range("c2:c" & i), s.Cells(i, "c")) = 1 Then
                urunCombo.AddItem s.Cells(i, 3).Value
            End If
        End If
    Next
urunCombo.ListIndex = 0
End Sub
 
Rica ederim.
 
Geri
Üst