mükerrer kayıt engelleme

Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Arkadaşlar mükerrer kayıtla ilgili örnek dosyaların hiçbirine ulaşamadım. UserFormdan kayıt yaparken mükerrer kayıtta uyarı verip kaydetmemesini istiyorum. Excel sayfasının koduna eklenen kodlar buldum ancak onlarda da user form ile kayıt yaptığımdan sorun çıktı.
 

N.Ziya Hiçdurmaz

Özel Üye
Katılım
28 Nisan 2007
Mesajlar
2,218
Excel Vers. ve Dili
Office 2013 TR / 32 Bit
Yanıt

Kod:
Private Sub CommandButton1_Click()
Dim sat, son As Integer
For sat = 2 To Cells(65536, "a").End(xlUp).Row
If Cells(sat, "a") = TextBox1 Then
MsgBox "Bu veriden daha önce girilmiş", vbInformation
Exit Sub: End If: Next
son = Cells(65536, "a").End(xlUp).Row + 1
Cells(son, "a") = TextBox1
End Sub
 

Ekli dosyalar

Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Zahmet olmazsa aşağıdaki benim kodlara uyarlayabilirmisiniz. Ben uğraştım yapamadım. Teşekkürler...

Private Sub CommandButton11_Click()

Dim sonsatir As Long
With Sayfa1
sonsatir = .Range("A65536").End(xlUp).Row + 1
.Range("A" & sonsatir).Value = Me.TextBox3.Text
.Range("B" & sonsatir).Value = Me.TextBox4.Text
.Range("C" & sonsatir).Value = Me.TextBox5.Text
.Range("D" & sonsatir).Value = Me.TextBox6.Text
.Range("E" & sonsatir).Value = Me.ComboBox1.Text
.Range("F" & sonsatir).Value = Me.TextBox10.Text
.Range("G" & sonsatir).Value = Me.TextBox11.Text
.Range("H" & sonsatir).Value = Me.TextBox12.Text
.Range("I" & sonsatir).Value = Me.ComboBox3.Text
.Range("J" & sonsatir).Value = Me.TextBox15.Text
.Range("K" & sonsatir).Value = Me.TextBox26.Text
.Range("L" & sonsatir).Value = Me.TextBox13.Text
.Range("M" & sonsatir).Value = Me.TextBox14.Text
.Range("N" & sonsatir).Value = Me.TextBox27.Text
.Range("O" & sonsatir).Value = Me.TextBox28.Text
.Range("P" & sonsatir).Value = Me.TextBox29.Text
.Range("BH" & sonsatir).Value = Me.TextBox57.Text
.Range("BI" & sonsatir).Value = Me.TextBox58.Text
.Range("BJ" & sonsatir).Value = Me.TextBox59.Text
.Range("BK" & sonsatir).Value = Me.TextBox60.Text
.Range("BL" & sonsatir).Value = Me.TextBox62.Text
.Range("BM" & sonsatir).Value = Me.TextBox63.Text
.Range("BN" & sonsatir).Value = Me.TextBox61.Text
.Range("BY" & sonsatir).Value = Me.TextBox70.Text
.Range("BZ" & sonsatir).Value = Me.TextBox71.Text
MsgBox "Kayıt Eklenmiştir. ", vbInformation, "Erdal ZENGİN"

End With


ActiveWorkbook.Save

temizlee

End Sub
 
Üst