Arkadaşlar kendi çapımda birkaç veri kayıt ekle yapıyorum ancak bir yerde yardımınıza ihtiyacım var. Kayıt bul tuşuna basarak excel de istediğim kaydı buluyorum ancak güncelle diye tıkladığımda ise bulmuş olduğum kaydı yeni kayıt olarak listeye tekrar ekliyor. Acaba listeye tekrar eklemeden sadece bulduğum veri üzerinde nasıl değişiklik yapabilirim.
Kod:
Private Sub ComboBox2_Change()
End Sub
Private Sub ComboBox3_Change()
End Sub
Private Sub ComboBox4_Change()
End Sub
Private Sub ComboBox5_Change()
End Sub
Private Sub CommandButton2_Click()
Dim a
On Error GoTo 10
a = InputBox("Lütfen Ad Soyad giriniz", "Kimi bulacağız?")
Range("B:B").Select
Selection.Find(a).Select
TextBox1 = ActiveCell.Offset(0, 0)
ComboBox1 = ActiveCell.Offset(0, 1)
TextBox3 = ActiveCell.Offset(0, 2)
TextBox4 = ActiveCell.Offset(0, 3)
ComboBox2 = ActiveCell.Offset(0, 4)
ComboBox3 = ActiveCell.Offset(0, 5)
TextBox7 = ActiveCell.Offset(0, 6)
TextBox8 = ActiveCell.Offset(0, 7)
ComboBox4 = ActiveCell.Offset(0, 8)
ComboBox5 = ActiveCell.Offset(0, 9)
GoTo 20
10
MsgBox "Aradığınız kişi sistemde bulunamadı"
20
Range("a1").Select
End Sub
Private Sub Label7_Click()
End Sub
Private Sub Label8_Click()
End Sub
Private Sub Label9_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox3_Change()
End Sub
Private Sub TextBox4_Change()
End Sub
Private Sub TextBox7_Change()
End Sub
Private Sub TextBox8_Change()
End Sub
Private Sub TextBox9_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
ComboBox1.RowSource = "Data!A1:A" & Sheets("Data").Cells(65536, "A").End(xlUp).Row
If ComboBox1.ListCount > 0 Then ComboBox1.ListIndex = 0
ComboBox2.RowSource = "Data!C1:C" & Sheets("Data").Cells(65536, "C").End(xlUp).Row
If ComboBox2.ListCount > 0 Then ComboBox2.ListIndex = 0
ComboBox3.RowSource = "Data!E1:E" & Sheets("Data").Cells(65536, "E").End(xlUp).Row
If ComboBox3.ListCount > 0 Then ComboBox2.ListIndex = 0
ComboBox4.RowSource = "Data!H1:H" & Sheets("Data").Cells(65536, "H").End(xlUp).Row
If ComboBox4.ListCount > 0 Then ComboBox2.ListIndex = 0
ComboBox5.RowSource = "Data!G1:G" & Sheets("Data").Cells(65536, "G").End(xlUp).Row
If ComboBox5.ListCount > 0 Then ComboBox5.ListIndex = 0
End Sub
Private Sub CommandButton1_Click()
If Range("a2") = "" Then
Range("a2").Select
ActiveCell = 1
ActiveCell.Offset(0, 1).Value = TextBox1.Value
ActiveCell.Offset(0, 2).Value = ComboBox1.Value
ActiveCell.Offset(0, 3).Value = TextBox3.Value
ActiveCell.Offset(0, 4).Value = TextBox4.Value
ActiveCell.Offset(0, 5).Value = ComboBox2.Value
ActiveCell.Offset(0, 6).Value = ComboBox3.Value
ActiveCell.Offset(0, 7).Value = TextBox7.Value
ActiveCell.Offset(0, 8).Value = TextBox8.Value
ActiveCell.Offset(0, 9).Value = ComboBox4.Value
ActiveCell.Offset(0, 10).Value = ComboBox5.Value
Else
[A65536].End(xlUp).Offset(1, 0).Select
ActiveCell = ActiveCell.Offset(-1, 0) + 1
ActiveCell.Offset(0, 1).Value = TextBox1.Value
ActiveCell.Offset(0, 2).Value = ComboBox1.Value
ActiveCell.Offset(0, 3).Value = TextBox3.Value
ActiveCell.Offset(0, 4).Value = TextBox4.Value
ActiveCell.Offset(0, 5).Value = ComboBox2.Value
ActiveCell.Offset(0, 6).Value = ComboBox3.Value
ActiveCell.Offset(0, 7).Value = TextBox7.Value
ActiveCell.Offset(0, 8).Value = TextBox8.Value
ActiveCell.Offset(0, 9).Value = ComboBox4.Value
ActiveCell.Offset(0, 10).Value = ComboBox5.Value
End If
TextBox1 = ""
ComboBox1 = ""
TextBox3 = ""
TextBox4 = ""
ComboBox2 = ""
ComboBox3 = ""
TextBox7 = ""
TextBox8 = ""
ComboBox4 = ""
ComboBox5 = ""
TextBox1.SetFocus
sat = Cells(Rows.Count, "B").End(xlUp).Row
Range("b2:K" & sat).Sort key1:=Range("C2"), key2:=Range("J2")
ThisWorkbook.Save
End Sub
