• DİKKAT

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

Kod Hatası Nerede

Katılım
12 Nisan 2012
Mesajlar
533
Excel Vers. ve Dili
Microsoft office professional plus 2019
Aşağıdaki kod ile listview1'den ve Anasayfadan veriyi silmeye çalışıyorum ama listview'den silmesine rağmen Anasayfadan silmiyor.Acaba hata nerede?


If listview1.SelectedItem Is Nothing Then Exit Sub
listview1.ListItems.Removelistview1.SelectedItem.Index
Set BUL = Sheets("Anasayfa").Range("a15:a500").Find(listview1.SelectedItem, lookat:=xlWhole)
If Not BUL Is Nothing Then
Sheets("Anasayfa").Rows(BUL.Row).Delete
End If
 
Aşağıdaki kodu deneyiniz.

Kod:
Dim l As ListItem
a = 0
    For s = 1 To ListView1.ListItems.Count
        If ListView1.ListItems(s).Checked = True Then
            a = a + 1
        End If
    Next s

If a = 0 Then
    MsgBox "Önce seçim yapmalısınız", , " Bilgilendirme "
Exit Sub
End If

cvp = MsgBox(" Silmek istediğinize emin misiniz?  ", vbYesNo, " Bilgilendirme ")
    If cvp = vbYes Then
   
Set c = Sheets("Anasayfa").Range("A:A").Find(ListView1.SelectedItem, , xlValues, xlWhole)
    For i = 1 To ListView1.ListItems.Count
         If ListView1.ListItems(i).Selected = True Then
Set l = ListView1.SelectedItem
   
Sheets("Anasayfa").Rows(c.Row).Delete
        End If
    Next

MsgBox "Kayıtlar Güncellendi.!", vbInformation, ""

    Else
MsgBox " Silme işlemi İPTAL EDİLDİ.  ", , " Bilgilendirme "
    Exit Sub
End If
 
Tamam çalıştı.Teşekkür ederim.
 
Geri
Üst