DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Merhabalar,
For e = 1 To ComboBox2.ListCount - 1
If ComboBox2.List(e) = ComboBox2.List(e - 1) Then
ComboBox2.RemoveItem e
End If
Next e
ile combobox mükerrer kayıtlarını silmek istiyorum. Ama hata alıyorum.
For e = ComboBox2.ListCount - 1 To 1 Step -1
If ComboBox2.List(e) = ComboBox2.List(e - 1) Then
ComboBox2.RemoveItem e
End If
Next e
Set alan = Worksheets(Sheet1).Range("A2:A50")
alan.Sort alan.Cells(1, 1)
For Each hücre In alan.Cells
If hücre.Value <> hücre.Offset(-1, 0).Value Then
ComboBox2.AddItem hücre.Value
End If
Next
Private Sub UserForm_Initialize()
Dim i As Integer
Dim x, hücre As Variant
With CreateObject("Scripting.Dictionary")
For i = 2 To Cells(Rows.Count, "A").End(3).Row
hücre = Cells(i, "A")
If Not .exists(hücre) Then .Add hücre, Nothing
Next i
x = .keys
End With
With Me.ComboBox1
.Clear
.List = x
.ListIndex = 1
End With
End Sub
codu ekteki gibi denermisiniz.
Kod:For e = ComboBox2.ListCount - 1 To 1 Step -1 If ComboBox2.List(e) = ComboBox2.List(e - 1) Then ComboBox2.RemoveItem e End If Next e
Çalıştı. Denemedim ama diğer arkadaşların cevapları için de teşekkür ederim. for satırını açıklayabilir misiniz.
Sondan Başa doğru gitttik. eğer batan sona doğru giderseniz 2 ciyi sildiğinde 3. otomatik olarak 2. olur ve o artık 2.ci işlmi yaptığı için 3. işlemi yapmadan 4.ileme atlar.