LİNDA
Gold Üye
- Katılım
- 4 Haz 2021
- Mesajlar
- 269
- Çözümler
- 1
- Aldığı beğeni
- 90
- Excel V
- Office 2019 TR
- Gold Bitiş
- 15 Nisan 2026
Konu Sahibi
Merhaba arkadaşlar ekteki dosyamda kaydet tuşu ve şu kodlarla veriyi kaydediyorum ve listbox1 de görünüyor. Kayıt sayısı arttıkça son kaydedilen verinin kaydedilip kaydedilmediğinden emin olmak için son satıra gitmek sıkıntı oluyor.. Ekrana gelen aday başarı ile kaydedildi. Mesajı ile ilk satırda görünsün tamam dediğimizde son satıra gitsin .Aynı durum güncelleme kodları içinde gerekecek sanırım.
Kaydet için:
Private Sub CommandButton4_Click()
On Error GoTo bitir
Dim pr As Worksheet
Set pr = Sheets("Sayfa2")
Dim aranan As String
Dim tablo As Range
Dim X As Integer, Data As Worksheet
Set Data = Worksheets("DATA")
Set tablo = pr.Range("A
")
aranan = TextBox1.Text
KayitSatiri = tablo.Find(aranan, LookIn:=xlValues, lookat:=xlWhole).Row
sonsatir = KayitSatiri
sonsatir = WorksheetFunction.CountA(Worksheets("DATA").Range("B:B")) + 1
say = WorksheetFunction.CountIf(Data.Range("B2:B" & sonsatir), aranan)
If ComboBox3.Value = "NAKİL GELECEK" Then
Data.Cells(sonsatir, 2) = TextBox1.Value
Data.Cells(sonsatir, 3) = TextBox2.Value
Data.Cells(sonsatir, 4) = TextBox3.Value
Data.Cells(sonsatir, 5) = TextBox4.Value
Data.Cells(sonsatir, 6) = TextBox5.Value
Data.Cells(sonsatir, 7) = TextBox6.Value
Data.Cells(sonsatir, 8) = ComboBox1.Value
Data.Cells(sonsatir, 9) = ComboBox2.Value
Data.Cells(sonsatir, 10) = TextBox7.Value
Data.Cells(sonsatir, 11) = TextBox8.Value
Data.Cells(sonsatir, 12) = TextBox9.Value
Data.Cells(sonsatir, 13) = ComboBox3.Value
Data.Cells(sonsatir, 14) = ComboBox4.Value
Data.Cells(sonsatir, 15) = TextBox10.Value
Data.Cells(sonsatir, 16) = TextBox11.Value
Data.Cells(sonsatir, 17) = TextBox12.Value
Data.Cells(sonsatir + 1, 2) = TextBox1.Value
Data.Cells(sonsatir + 1, 3) = TextBox2.Value
Data.Cells(sonsatir + 1, 4) = TextBox3.Value
Data.Cells(sonsatir + 1, 5) = TextBox4.Value
Data.Cells(sonsatir + 1, 6) = TextBox5.Value
Data.Cells(sonsatir + 1, 7) = TextBox6.Value
Data.Cells(sonsatir + 1, 8) = ComboBox1.Value
Data.Cells(sonsatir + 1, 9) = ComboBox2.Value
Data.Cells(sonsatir + 1, 10) = TextBox7.Value
Data.Cells(sonsatir + 1, 11) = TextBox8.Value
Data.Cells(sonsatir + 1, 12) = TextBox9.Value
Data.Cells(sonsatir + 1, 13) = "KESİN KAYIT"
Data.Cells(sonsatir + 1, 14) = ComboBox4.Value
Data.Cells(sonsatir + 1, 15) = TextBox10.Value
Data.Cells(sonsatir + 1, 16) = TextBox11.Value
Data.Cells(sonsatir + 1, 17) = TextBox12.Value
End If
If say = 1 Then
sor = MsgBox(aranan & " T.C. Kimlik Numaralı öğrenci kayıt edilmiş" & Chr(10) & Chr(10) & "Güncelleme yapılacak mı?", vbYesNo + vbInformation, "Bilgi")
If sor = vbYes Then
guncelle
MsgBox aranan & " T.C. Kimlik Numaralı Kayıt Güncellenmiştir.", vbInformation, "Bilgi"
Else
MsgBox "İşlem iptal edilmiştir.", vbInformation, "Bilgi"
temizle
End If
Exit Sub
End If
Data.Cells(sonsatir, 2) = TextBox1.Value
Data.Cells(sonsatir, 3) = TextBox2.Value
Data.Cells(sonsatir, 4) = TextBox3.Value
Data.Cells(sonsatir, 5) = TextBox4.Value
Data.Cells(sonsatir, 6) = TextBox5.Value
Data.Cells(sonsatir, 7) = TextBox6.Value
Data.Cells(sonsatir, 8) = ComboBox1.Value
Data.Cells(sonsatir, 9) = ComboBox2.Value
Data.Cells(sonsatir, 10) = TextBox7.Value
Data.Cells(sonsatir, 11) = TextBox8.Value
Data.Cells(sonsatir, 12) = TextBox9.Value
Data.Cells(sonsatir, 13) = ComboBox3.Value
Data.Cells(sonsatir, 14) = ComboBox4.Value
Data.Cells(sonsatir, 15) = TextBox10.Value
Data.Cells(sonsatir, 16) = TextBox11.Value
Data.Cells(sonsatir, 17) = TextBox12.Value
Data.Cells(2, 1).Value = 1
Data.Cells(sonsatir, 23) = kullanici & " " & Now
For X = 3 To sonsatir
Data.Cells(X, 1).Value = Data.Cells(X - 1, 1).Value + 1
Next X
'For Each i In Me.Controls
'If TypeName(i) = "TextBox" Or TypeName(i) = "ComboBox" Then i.Value = ""
'If TypeName(i) = "OptionButton" Or TypeName(i) = "CheckBox" Then i.Value = False
'Next i
temizle
Set Data = Nothing: X = 0
UserForm_Initialize
'sırala
bitir: MsgBox "ADAY BAŞARI İLE KAYDEDİLDİ", vbOKOnyl + vbInformation, " BİLGİ !"
End Sub
ve güncelleme için ise
Private Sub CommandButton2_Click()
Dim Data As Worksheet
If TextBox1.Text = "" Then Exit Sub
Set Data = Worksheets("DATA")
aranan = TextBox1.Text
sor = MsgBox(aranan & " T.C. Kimlik Numaralı Öğrenci Bilgileri İçin Güncelleme Yapılacak mı?", vbYesNo + vbInformation, "Bilgi")
If sor = vbNo Then Exit Sub
değiştir_satır = Worksheets("DATA").Range("B:B").Find(aranan).Row
Worksheets("DATA").Cells(değiştir_satır, 3) = TextBox2.Value
Worksheets("DATA").Cells(değiştir_satır, 4) = CDate(TextBox3.Value)
Worksheets("DATA").Cells(değiştir_satır, 5) = TextBox4.Value
Worksheets("DATA").Cells(değiştir_satır, 6) = TextBox5.Value
Worksheets("DATA").Cells(değiştir_satır, 7) = TextBox6.Value
Worksheets("DATA").Cells(değiştir_satır, 8) = ComboBox1.Value
Worksheets("DATA").Cells(değiştir_satır, 9) = ComboBox2.Value
Worksheets("DATA").Cells(değiştir_satır, 10) = TextBox7.Value
Worksheets("DATA").Cells(değiştir_satır, 11) = TextBox8.Value
Worksheets("DATA").Cells(değiştir_satır, 12) = TextBox9.Value
Worksheets("DATA").Cells(değiştir_satır, 13) = ComboBox3.Value
Worksheets("DATA").Cells(değiştir_satır, 14) = ComboBox4.Value
Worksheets("DATA").Cells(değiştir_satır, 15) = TextBox10.Value
Worksheets("DATA").Cells(değiştir_satır, 16) = TextBox11.Value
Worksheets("DATA").Cells(değiştir_satır, 17) = TextBox12.Value
Worksheets("DATA").Cells(değiştir_satır, 24) = kullanici & " " & Now
'For Each i In Me.Controls
'If TypeName(i) = "TextBox" Or TypeName(i) = "ComboBox" Then i.Value = ""
'If TypeName(i) = "OptionButton" Or TypeName(i) = "CheckBox" Then i.Value = False
'Next i
temizle
UserForm_Initialize
Set Data = Nothing
End Sub
bu kodlarda nasıl bir düzenleme yapabiliriz
Kaydet için:
Private Sub CommandButton4_Click()
On Error GoTo bitir
Dim pr As Worksheet
Set pr = Sheets("Sayfa2")
Dim aranan As String
Dim tablo As Range
Dim X As Integer, Data As Worksheet
Set Data = Worksheets("DATA")
Set tablo = pr.Range("A

aranan = TextBox1.Text
KayitSatiri = tablo.Find(aranan, LookIn:=xlValues, lookat:=xlWhole).Row
sonsatir = KayitSatiri
sonsatir = WorksheetFunction.CountA(Worksheets("DATA").Range("B:B")) + 1
say = WorksheetFunction.CountIf(Data.Range("B2:B" & sonsatir), aranan)
If ComboBox3.Value = "NAKİL GELECEK" Then
Data.Cells(sonsatir, 2) = TextBox1.Value
Data.Cells(sonsatir, 3) = TextBox2.Value
Data.Cells(sonsatir, 4) = TextBox3.Value
Data.Cells(sonsatir, 5) = TextBox4.Value
Data.Cells(sonsatir, 6) = TextBox5.Value
Data.Cells(sonsatir, 7) = TextBox6.Value
Data.Cells(sonsatir, 8) = ComboBox1.Value
Data.Cells(sonsatir, 9) = ComboBox2.Value
Data.Cells(sonsatir, 10) = TextBox7.Value
Data.Cells(sonsatir, 11) = TextBox8.Value
Data.Cells(sonsatir, 12) = TextBox9.Value
Data.Cells(sonsatir, 13) = ComboBox3.Value
Data.Cells(sonsatir, 14) = ComboBox4.Value
Data.Cells(sonsatir, 15) = TextBox10.Value
Data.Cells(sonsatir, 16) = TextBox11.Value
Data.Cells(sonsatir, 17) = TextBox12.Value
Data.Cells(sonsatir + 1, 2) = TextBox1.Value
Data.Cells(sonsatir + 1, 3) = TextBox2.Value
Data.Cells(sonsatir + 1, 4) = TextBox3.Value
Data.Cells(sonsatir + 1, 5) = TextBox4.Value
Data.Cells(sonsatir + 1, 6) = TextBox5.Value
Data.Cells(sonsatir + 1, 7) = TextBox6.Value
Data.Cells(sonsatir + 1, 8) = ComboBox1.Value
Data.Cells(sonsatir + 1, 9) = ComboBox2.Value
Data.Cells(sonsatir + 1, 10) = TextBox7.Value
Data.Cells(sonsatir + 1, 11) = TextBox8.Value
Data.Cells(sonsatir + 1, 12) = TextBox9.Value
Data.Cells(sonsatir + 1, 13) = "KESİN KAYIT"
Data.Cells(sonsatir + 1, 14) = ComboBox4.Value
Data.Cells(sonsatir + 1, 15) = TextBox10.Value
Data.Cells(sonsatir + 1, 16) = TextBox11.Value
Data.Cells(sonsatir + 1, 17) = TextBox12.Value
End If
If say = 1 Then
sor = MsgBox(aranan & " T.C. Kimlik Numaralı öğrenci kayıt edilmiş" & Chr(10) & Chr(10) & "Güncelleme yapılacak mı?", vbYesNo + vbInformation, "Bilgi")
If sor = vbYes Then
guncelle
MsgBox aranan & " T.C. Kimlik Numaralı Kayıt Güncellenmiştir.", vbInformation, "Bilgi"
Else
MsgBox "İşlem iptal edilmiştir.", vbInformation, "Bilgi"
temizle
End If
Exit Sub
End If
Data.Cells(sonsatir, 2) = TextBox1.Value
Data.Cells(sonsatir, 3) = TextBox2.Value
Data.Cells(sonsatir, 4) = TextBox3.Value
Data.Cells(sonsatir, 5) = TextBox4.Value
Data.Cells(sonsatir, 6) = TextBox5.Value
Data.Cells(sonsatir, 7) = TextBox6.Value
Data.Cells(sonsatir, 8) = ComboBox1.Value
Data.Cells(sonsatir, 9) = ComboBox2.Value
Data.Cells(sonsatir, 10) = TextBox7.Value
Data.Cells(sonsatir, 11) = TextBox8.Value
Data.Cells(sonsatir, 12) = TextBox9.Value
Data.Cells(sonsatir, 13) = ComboBox3.Value
Data.Cells(sonsatir, 14) = ComboBox4.Value
Data.Cells(sonsatir, 15) = TextBox10.Value
Data.Cells(sonsatir, 16) = TextBox11.Value
Data.Cells(sonsatir, 17) = TextBox12.Value
Data.Cells(2, 1).Value = 1
Data.Cells(sonsatir, 23) = kullanici & " " & Now
For X = 3 To sonsatir
Data.Cells(X, 1).Value = Data.Cells(X - 1, 1).Value + 1
Next X
'For Each i In Me.Controls
'If TypeName(i) = "TextBox" Or TypeName(i) = "ComboBox" Then i.Value = ""
'If TypeName(i) = "OptionButton" Or TypeName(i) = "CheckBox" Then i.Value = False
'Next i
temizle
Set Data = Nothing: X = 0
UserForm_Initialize
'sırala
bitir: MsgBox "ADAY BAŞARI İLE KAYDEDİLDİ", vbOKOnyl + vbInformation, " BİLGİ !"
End Sub
ve güncelleme için ise
Private Sub CommandButton2_Click()
Dim Data As Worksheet
If TextBox1.Text = "" Then Exit Sub
Set Data = Worksheets("DATA")
aranan = TextBox1.Text
sor = MsgBox(aranan & " T.C. Kimlik Numaralı Öğrenci Bilgileri İçin Güncelleme Yapılacak mı?", vbYesNo + vbInformation, "Bilgi")
If sor = vbNo Then Exit Sub
değiştir_satır = Worksheets("DATA").Range("B:B").Find(aranan).Row
Worksheets("DATA").Cells(değiştir_satır, 3) = TextBox2.Value
Worksheets("DATA").Cells(değiştir_satır, 4) = CDate(TextBox3.Value)
Worksheets("DATA").Cells(değiştir_satır, 5) = TextBox4.Value
Worksheets("DATA").Cells(değiştir_satır, 6) = TextBox5.Value
Worksheets("DATA").Cells(değiştir_satır, 7) = TextBox6.Value
Worksheets("DATA").Cells(değiştir_satır, 8) = ComboBox1.Value
Worksheets("DATA").Cells(değiştir_satır, 9) = ComboBox2.Value
Worksheets("DATA").Cells(değiştir_satır, 10) = TextBox7.Value
Worksheets("DATA").Cells(değiştir_satır, 11) = TextBox8.Value
Worksheets("DATA").Cells(değiştir_satır, 12) = TextBox9.Value
Worksheets("DATA").Cells(değiştir_satır, 13) = ComboBox3.Value
Worksheets("DATA").Cells(değiştir_satır, 14) = ComboBox4.Value
Worksheets("DATA").Cells(değiştir_satır, 15) = TextBox10.Value
Worksheets("DATA").Cells(değiştir_satır, 16) = TextBox11.Value
Worksheets("DATA").Cells(değiştir_satır, 17) = TextBox12.Value
Worksheets("DATA").Cells(değiştir_satır, 24) = kullanici & " " & Now
'For Each i In Me.Controls
'If TypeName(i) = "TextBox" Or TypeName(i) = "ComboBox" Then i.Value = ""
'If TypeName(i) = "OptionButton" Or TypeName(i) = "CheckBox" Then i.Value = False
'Next i
temizle
UserForm_Initialize
Set Data = Nothing
End Sub
bu kodlarda nasıl bir düzenleme yapabiliriz
Ekli dosyalar
Bu konu çözüme ulaşmıştır yüklü dosyaları indirmek için Bronz üye olunuz.
Bu dosyayı indirmek için yetkiniz bulunmamaktadır.