Private Sub btn_KayitSil_Click()
Dim dic As Object, i As Long
Dim dizi, sonTabloSatr As Long, aranan
If Len(Trim(TextBox_ID.Value)) = 0 Then Exit Sub
If Len(Trim(ComboBox_FirmaUnvani.Value)) = 0 Then Exit Sub
If MsgBox("Veriler Silinecek, Emin misiniz...?", vbExclamation + vbYesNo, "Firma Tanýmlama Formu") = vbNo Then Exit Sub
With ThisWorkbook.Worksheets("Ana_Sayfa")
sonTabloSatr = .Cells.Find("*", _
SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlPrevious).Row
If WorksheetFunction.CountA(.Range("A2:A" & Rows.Count)) = 0 Then Exit Sub
If sonTabloSatr < 2 Then Exit Sub
Set dic = CreateObject("scripting.dictionary")
If WorksheetFunction.CountA(.Range("A2:A" & Rows.Count)) = 1 Then
dic.Add CStr(.Range("A" & sonTabloSatr).Value), 2
ElseIf WorksheetFunction.CountA(.Range("A2:A" & Rows.Count)) > 1 Then
dizi = .Range("A2:A" & sonTabloSatr).Value
For i = LBound(dizi) To UBound(dizi)
aranan = CStr(dizi(i, 1))
If dic.Exists(aranan) = False Then dic.Add aranan, i + 1
Next
Erase dizi
End If
If dic.Count = 0 Then Exit Sub
.Unprotect "171717"
.Rows(dic(CStr(Me.TextBox_ID.Value))).Delete
UserForm_Initialize
.Protect "171717"
Call temizle
TextBox_Tarih = Format(Date, "dd.mm.yyyy")
End With
TextBox_Tarih.SetFocus
With TextBox_Tarih
.SelStart = 0
.SelLength = .TextLength
End With
btn_KayitEkle.Enabled = True
Set dic = Nothing
MsgBox "Kayit silindi..", vbInformation, "Bilgi"
End Sub
Buda alternatif olsun dictionary ve dizi ile