selam. Makrolarda yeniyim. Aşağıdaki gibi bir kod buldum. Ama listview e aktarırken sorun oluyor; 8 nolu öğrenciyi aktar deyince 882, 801, 889 vb. tüm kayıtları getiriyor. Yani içinde 8 olan tüm numaraları listeliyor. Bunu düzeltebilir miyim?
Private Sub CommandButton4_Click()
Dim sorgu, sorgu2 As Variant
Set sh = Sheets("Sayfa4")
sorgu = UCase(Replace(Replace(Me.TextBox1.Value, "i", "İ"), "ı", "I"))
son = sh.Cells(65536, "A").End(xlUp).Row
UserForm1.ListView1.ListItems.Clear
For i = 2 To son
If UCase(Replace(Replace(sh.Cells(i, 2).Value, "i", "İ"), "ı", "I")) Like "*" & sorgu & "*" Then
With UserForm1.ListView1
.ListItems.Add , , sh.Cells(i, 1)
x = x + 1
With .ListItems(x)
.SubItems(1) = sh.Cells(i, 2)
.SubItems(2) = sh.Cells(i, 3)
.SubItems(3) = sh.Cells(i, 4)
.SubItems(4) = sh.Cells(i, 5)
End With
End With
End If
Next i
End Sub
şimdiden teşekkür ederim.
Private Sub CommandButton4_Click()
Dim sorgu, sorgu2 As Variant
Set sh = Sheets("Sayfa4")
sorgu = UCase(Replace(Replace(Me.TextBox1.Value, "i", "İ"), "ı", "I"))
son = sh.Cells(65536, "A").End(xlUp).Row
UserForm1.ListView1.ListItems.Clear
For i = 2 To son
If UCase(Replace(Replace(sh.Cells(i, 2).Value, "i", "İ"), "ı", "I")) Like "*" & sorgu & "*" Then
With UserForm1.ListView1
.ListItems.Add , , sh.Cells(i, 1)
x = x + 1
With .ListItems(x)
.SubItems(1) = sh.Cells(i, 2)
.SubItems(2) = sh.Cells(i, 3)
.SubItems(3) = sh.Cells(i, 4)
.SubItems(4) = sh.Cells(i, 5)
End With
End With
End If
Next i
End Sub
şimdiden teşekkür ederim.
