arkadaşlar değiştir butonumda log tutabiliyorum kllkyt sekmesine değiştirilen poliçe numarası olarak poliçe numarasını atıyor ama kaydet ve sil butonunda poliçe numarasını atmıyor yardım yardımcı olurmusunuz...
değiştir butonu
kaydet butonu
sil butonu
değiştir butonu
Kod:
Private Sub CommandButton7_Click()
'Değiştir butonuna basıldığında yapılacak işlemler.
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
'mesaj kutusu devreye giriyor.
If sor = vbNo Then Exit Sub
'evet veya hayır cevaplarından Hayır ise kodlar sonlandırılıyor.
sonsat = ListBox1.ListIndex + 2
'son satır numarası alınıyor.
Cells(sonsat, 2) = Format(mpbs, "dd.mm.yyyy")
'ikinci sutununun en son satırına textbox2 deki açıklama yazılıyor.
Cells(sonsat, 3) = Format(mpbt, "dd.mm.yyyy")
Cells(sonsat, 4) = TextBox1
Cells(sonsat, 5) = TextBox2
Cells(sonsat, 6) = ComboBox1
Cells(sonsat, 7) = ComboBox8
Cells(sonsat, 8) = TextBox4
Cells(sonsat, 9) = TextBox5
Cells(sonsat, 10) = ComboBox2
Cells(sonsat, 11) = ComboBox3
Cells(sonsat, 12) = ComboBox4
Cells(sonsat, 13) = ComboBox5
Cells(sonsat, 14) = ComboBox6
Cells(sonsat, 15) = TextBox6
Cells(sonsat, 16) = TextBox7
Cells(sonsat, 17) = TextBox8
Cells(sonsat, 18) = TextBox9
Cells(sonsat, 19) = ComboBox7
Cells(sonsat, 20) = Format(mbt, "dd.mm.yyyy")
Cells(sonsat, 21) = TextBox11
Cells(sonsat, 22) = TextBox12
Cells(sonsat, 23) = TextBox13
Cells(sonsat, 24) = TextBox14
Cells(sonsat, 25) = TextBox15
Cells(sonsat, 26) = TextBox16
Cells(sonsat, 27) = TextBox10
ListBox1.RowSource = "B2:AA" & [a65536].End(3).Row
'liste kutusunun satır kaynagının hangi hücreler olduğu belirtiliyor.
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
If sclr >= 500 Then
ActiveWorkbook.Sheets("KLLKYT").Range("A2:G2").SpecialCells(xlCellTypeVisible).EntireRow.Delete
End If
nwrght = Sheets("KLLKYT").Cells(65536, "A").End(xlUp).Row + 1
Sheets("KLLKYT").Cells(nwrght, "A") = "" & Sheets("PAROLA").Range("D2") & ""
Sheets("KLLKYT").Cells(nwrght, "B") = "" & Sheets("PAROLA").Range("E2") & ""
Sheets("KLLKYT").Cells(nwrght, "C") = "Değişiklik Yapıldı"
Sheets("KLLKYT").Cells(nwrght, "D") = Format(Date, "mm.dd.yyyy")
Sheets("KLLKYT").Cells(nwrght, "E") = Format(Time, "hh:mm:ss")
Sheets("KLLKYT").Cells(nwrght, "F") = "Değiştirilen Kayıt Poliçe no : " & ComboBox1.Value
ComboBox1.SetFocus: ComboBox1 = ""
CommandButton4_Click
UserForm_Initialize
CommandButton1.Enabled = True
End Sub
kaydet butonu
Kod:
Private Sub CommandButton1_Click()
Dim Satır As Long
If TextBox1 = "" Then
MsgBox "Lütfen sigortalının Adı-Soyadı bilgisiniz giriniz !", vbCritical
TextBox1.SetFocus
Exit Sub
End If
If TextBox2 = "" Then
MsgBox "Lütfen sigortalının TC Kimlik No bilgisiniz giriniz !", vbCritical
TextBox2.SetFocus
Exit Sub
End If
With Sheets("POLİCE")
If WorksheetFunction.CountIf(.Range("F:F"), ComboBox1) > 0 Then
MsgBox ComboBox1 & " nolu poliçe daha önce kayıt edilmiştir. Lütfen kontrol ediniz !", vbCritical
ComboBox1.SelStart = 0
ComboBox1.SelLength = Len(ComboBox1)
ComboBox1.SetFocus
Exit Sub
End If
Satır = .Range("a65536").End(3).Row + 1
.Cells(Satır, "A") = Satır - 1
.Cells(Satır, "B") = Format(mpbs, "dd.mm.yyyy")
.Cells(Satır, "C") = Format(mpbt, "dd.mm.yyyy")
.Cells(Satır, "D") = TextBox1
.Cells(Satır, "E") = TextBox2
.Cells(Satır, "F") = ComboBox1
.Cells(Satır, "G") = ComboBox8
.Cells(Satır, "H") = TextBox4
.Cells(Satır, "I") = TextBox5
.Cells(Satır, "J") = ComboBox2
.Cells(Satır, "K") = ComboBox3
.Cells(Satır, "L") = ComboBox4
.Cells(Satır, "M") = ComboBox5
.Cells(Satır, "N") = ComboBox6
.Cells(Satır, "O") = TextBox6
.Cells(Satır, "P") = TextBox7
.Cells(Satır, "Q") = TextBox8
.Cells(Satır, "R") = TextBox9
.Cells(Satır, "S") = ComboBox7
.Cells(Satır, "T") = Format(mbt, "dd.mm.yyyy")
.Cells(Satır, "U") = TextBox11
.Cells(Satır, "V") = TextBox12
.Cells(Satır, "W") = TextBox13
.Cells(Satır, "X") = TextBox14
.Cells(Satır, "Y") = TextBox15
.Cells(Satır, "Z") = TextBox16
.Cells(Satır, "AA") = TextBox10
End With
MsgBox "Kayıt işlemi tamamlanmıştır.", vbInformation
CommandButton4_Click
UserForm_Initialize
CommandButton7.Enabled = False
If sclr >= 500 Then
ActiveWorkbook.Sheets("KLLKYT").Range("A2:G2").SpecialCells(xlCellTypeVisible).EntireRow.Delete
End If
nwrght = Sheets("KLLKYT").Cells(65536, "A").End(xlUp).Row + 1
Sheets("KLLKYT").Cells(nwrght, "A") = "" & Sheets("PAROLA").Range("D2") & ""
Sheets("KLLKYT").Cells(nwrght, "B") = "" & Sheets("PAROLA").Range("E2") & ""
Sheets("KLLKYT").Cells(nwrght, "C") = "Kayıt Yapıldı"
Sheets("KLLKYT").Cells(nwrght, "D") = Format(Date, "mm.dd.yyyy")
Sheets("KLLKYT").Cells(nwrght, "E") = Format(Time, "hh:mm:ss")
Sheets("KLLKYT").Cells(nwrght, "F") = "Yeni Kayıt Poliçe no : " & ComboBox1.Value
ComboBox1.SetFocus: ComboBox1 = ""
CommandButton4_Click
UserForm_Initialize
CommandButton1.Enabled = True
End Sub
sil butonu
Kod:
Private Sub CommandButton3_Click()
'Seçilen kaydı sil butonuna basıldığında yapılacak işlemler.
sor = MsgBox("Silmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sat = ListBox1.ListIndex + 2
Range("B" & sat & ":AA" & sat).Delete
'B ve I sutunları En satır numarası ile birleştiriliyor.
'silincek hücre adresleri bulunuyor.
'B sütunu ve I sutunu arasında kalan hücreler siliniyor.
[a65536].End(3).ClearContents
Range("a2:AA" & [a65536].End(3).Row).Interior.ColorIndex = xlNone
'A2 ile J sütununun en son dolu olan hücresi arasında kalan hücrelerin.
'dolgu renkleri siliniyor.
UserForm_Initialize
'user formun initalize çalıştırılıyor.
CommandButton4_Click
'CommandButton5_Click olayı çalıştırılıyor.
MsgBox "SEÇİLEN VERİ SİLİNMİŞTİR"
If sclr >= 500 Then
ActiveWorkbook.Sheets("KLLKYT").Range("A2:G2").SpecialCells(xlCellTypeVisible).EntireRow.Delete
End If
nwrght = Sheets("KLLKYT").Cells(65536, "A").End(xlUp).Row + 1
Sheets("KLLKYT").Cells(nwrght, "A") = "" & Sheets("PAROLA").Range("D2") & ""
Sheets("KLLKYT").Cells(nwrght, "B") = "" & Sheets("PAROLA").Range("E2") & ""
Sheets("KLLKYT").Cells(nwrght, "C") = "Poliçe Sildi"
Sheets("KLLKYT").Cells(nwrght, "D") = Format(Date, "mm.dd.yyyy")
Sheets("KLLKYT").Cells(nwrght, "E") = Format(Time, "hh:mm:ss")
Sheets("KLLKYT").Cells(nwrght, "F") = "Silinen Poliçe no : " & ComboBox1.Value
ComboBox1.SetFocus: ComboBox1 = ""
CommandButton4_Click
UserForm_Initialize
CommandButton1.Enabled = True
End Sub
