Soru kaydet hatası

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,532
Excel Vers. ve Dili
2021 LTSC TR
Altın Üyelik Bitiş Tarihi
18-06-2026
Userformda yapılan kayıt esnasında Textbox6 da ki TC daha önce kayıt yapılmış ise Private Sub TextBox6_Exit koduna göre userformda ki nesnelere bilgileri getiriyor. KAYDET butonu yazısı DEĞİŞTİR oluyor.
Eger TC kaydı yok ise aşağıda ki kod işlem yapıyor.
Kod:
If CommandButton1.Caption = "KAYDET" Then
Son_Dolu_Satir = Workbooks(".........").Sheets("Personel").Range("C65536").End(xlUp).Row
Bos_Satir = Son_Dolu_Satir + 1
Range("C" & Bos_Satir).Value = TextBox6.Value
Range("D" & Bos_Satir).Value = TextBox7.Value
Range("E" & Bos_Satir).Value = TextBox8.Value
Range("F" & Bos_Satir).Value = ComboBox7.Value
Range("G" & Bos_Satir).Value = ComboBox8.Value
Range("H" & Bos_Satir).Value = TextBox9.Value
Range("I" & Bos_Satir).Value = ComboBox9.Value
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
ComboBox7.Value = ""
ComboBox8.Value = ""
TextBox9.Text = ""
ComboBox9.Value = ""
Workbooks("..........").Sheets("Personel").Select
Else
Range("C" & satirnosu).Value = TextBox6.Value
Range("D" & satirnosu).Value = TextBox7.Value
Range("E" & satirnosu).Value = TextBox8.Value
Range("F" & satirnosu).Value = ComboBox7.Value
Range("G" & satirnosu).Value = ComboBox8.Value
Range("H" & satirnosu).Value = TextBox9.Value
Range("I" & satirnosu).Value = ComboBox9.Value
End If
End Sub
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TCKimlikOnYazimKontrol(TextBox6.Text) = False Then
Me.TextBox6 = ""
MsgBox "Hatalı T.C Kimlik No Girdiniz", vbCritical
Cancel = True
Me.TextBox6.SetFocus
End If
Dim Son_Dolu_Satir As Long
Dim tcvarmi As Range
Son_Dolu_Satir = Range("B65536").End(xlUp).Row
Set tcvarmi = Range("C3:C" & Son_Dolu_Satir).Find(TextBox6.Value, LookIn:=xlValues, lookat:=xlWhole)
If tcvarmi Is Nothing Then
CommandButton1.Caption = "Kaydet"
Else
satirnosu = tcvarmi.Row
CommandButton1.Caption = "Değiştir"
TextBox6.Value = Range("C" & satirnosu).Value
TextBox7.Value = Range("D" & satirnosu).Value
TextBox8.Value = Range("E" & satirnosu).Value
ComboBox7.Value = Range("F" & satirnosu).Value
ComboBox8.Value = Range("G" & satirnosu).Value
TextBox9.Value = Range("H" & satirnosu).Value
ComboBox9.Value = Range("I" & satirnosu).Value
End If
End Sub
Ancak KAYDET kodunda ki aşağıdaki kısım
Kod:
Range("C" & satirnosu).Value = TextBox6.Value
Range("D" & satirnosu).Value = TextBox7.Value
Range("E" & satirnosu).Value = TextBox8.Value
Range("F" & satirnosu).Value = ComboBox7.Value
Range("G" & satirnosu).Value = ComboBox8.Value
Range("H" & satirnosu).Value = TextBox9.Value
Range("I" & satirnosu).Value = ComboBox9.Value
kısmı hata veriyor.
Yardımcı olabilir misiniz?
 

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,532
Excel Vers. ve Dili
2021 LTSC TR
Altın Üyelik Bitiş Tarihi
18-06-2026
Sıkıntımı giderdim.
Sadece kayıt yaparken B sütununa sıra numarası vermiyor. Ne yapabilirim?
 

muratboz06

Destek Ekibi
Destek Ekibi
Katılım
23 Mart 2017
Mesajlar
568
Excel Vers. ve Dili
Office365 TR
Kodun yeni kayıt yaptığı bölüme ekleyiniz. (Yukarıda paylaştığınız kodun 4. satırına olabilir.)
Kod:
Range("B" & Bos_Satir).Value = Range("B" & Bos_Satir).Offset(-1, 0) + 1
 
Üst