Merhaba arkadaşlar.
Aşağıdaki kodlar ile ComboBox5'e sayfadaki N sütunundan veri alıyorum, change yordamı ile de listwiev'da filtre ediyorum.
Ancak N sütunu ile ilişkili olarak O ve P sütunlarında da veriler mevcut, bunları da combobox6 ve 7 ye de almak istiyorum.
İl, ilçe, belde misali.
Yardımcı olacak dostlara teşekkür ederim.
Aşağıdaki kodlar ile ComboBox5'e sayfadaki N sütunundan veri alıyorum, change yordamı ile de listwiev'da filtre ediyorum.
Ancak N sütunu ile ilişkili olarak O ve P sütunlarında da veriler mevcut, bunları da combobox6 ve 7 ye de almak istiyorum.
İl, ilçe, belde misali.
Yardımcı olacak dostlara teşekkür ederim.
Kod:
Private Sub UserForm_Activate()
Set k = ActiveSheet
For a = 2 To k.[a65536].End(3).Row
If WorksheetFunction.CountIf(k.Range("n1:n" & a), k.Cells(a, "n")) = 1 Then
ComboBox5.AddItem k.Cells(a, "n").Value
End If
Next
End Sub
Kod:
Private Sub ComboBox5_Change()
Set sh = ActiveSheet
son = sh.Cells(65536, 2).End(xlUp).Row
ListView1.ListItems.Clear
ListView1.View = lvwReport
With ListView1
j = 1
For j = 2 To son
If CStr(Cells(j, 14)) = CStr(ComboBox5) Or ComboBox5 = "" Or InStr(1, Cells(j, 14), ComboBox5, vbTextCompare) > 0 Then
i = ListView1.ListItems.Count + 1
.ListItems.Add , , CStr(j)
.ListItems(i).SubItems(1) = Cells(j, 1) 'T.C. Kimlik No
.ListItems(i).SubItems(2) = Cells(j, 2) 'Adı
.ListItems(i).SubItems(3) = Cells(j, 3) 'Soyadı
.ListItems(i).SubItems(4) = Cells(j, 4) 'Cinsiyeti
.ListItems(i).SubItems(5) = Cells(j, 5) 'D.Tarihi
.ListItems(i).SubItems(6) = Cells(j, 7) 'Ünvanı
.ListItems(i).SubItems(7) = Cells(j, 8) 'Branşı
.ListItems(i).SubItems(8) = Cells(j, 9) 'Aile Hekimliği
.ListItems(i).SubItems(9) = Cells(j, 10) 'İlçesi
.ListItems(i).SubItems(10) = Cells(j, 11) 'Kurum Sicili
.ListItems(i).SubItems(11) = Cells(j, 12) 'Kadro
.ListItems(i).SubItems(12) = Cells(j, 13) 'Sınıf
.ListItems(i).SubItems(13) = Cells(j, 14) 'Kurumu
.ListItems(i).SubItems(14) = Cells(j, 15) 'Birimi
.ListItems(i).SubItems(15) = Cells(j, 16) 'Yan Birimi
.ListItems(i).SubItems(16) = Cells(j, 17) 'Durumu
.ListItems(i).SubItems(17) = Cells(j, 18) 'Söz. Baş. Tarihi
.ListItems(i).SubItems(18) = Cells(j, 19) 'Söz. Bit. Tarihi
.ListItems(i).SubItems(19) = Cells(j, 20) 'Kadro Görev Yeri
.ListItems(i).SubItems(20) = Cells(j, 21) 'Açıklama
.ListItems(i).SubItems(21) = Format(Cells(j, 22).Value, "0### ### ## ##") 'GSM
.ListItems(i).SubItems(22) = Cells(j, 23) 'e-posta
End If
If j Mod 1 = 0 Then
End If
Next
End With
ListView1.FullRowSelect = True
ListView1.Gridlines = True
End Sub
Son düzenleme:
