1. Form aç butonuna bastığımızda text value kutularından birinde 12.MADDE kelimesi otomatik olması gerekmekte idi ancak ilk açılışta otomatik gelmekte fakat form temizle tuşana basıp yeni bir kayıt yapmak istediğimde 12.MADDE
kelimesi ortadan kaybolmakta.(deneyiniz anlarsınız) Ayrıca yeni eklediğim kişilerde yine isim engeli çıkıyor ;
Örnek : Yusuf Kosif diye birini girmek istiyorum
Bir önceki yusufun bilgilerine güncellendi diyor yani eski kaydı güncelliyor.
userform1 deki kodlarınızın tamamını aşağıdakiyle değiştiriniz.. yaptığınız kaydı b sütununda isim aynı olunca uyarmak yerine güncelliyor du artık TC. no ya göre arayacak eğer aynı TC no varsa uyaracak ..
güncelleme butonu eklendi güncellemek gerekirse bilgiler girilip güncelleme butonuna tıklanacak....
Private Sub ComboBox1_Change()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
For Each ara In s1.Range("A1:A" & s1.Cells(65536, 1).End(xlUp).Row)
If StrConv(Val(ara.Value), vbUpperCase) = StrConv(Val(ComboBox1.Value), vbUpperCase) Then
TextBox13.Value = s1.Range(ara.Offset(0, 1).Address).Value
Exit Sub
End If
Next ara
End Sub
Private Sub ComboBox3_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
TEMIZLE1
End Sub
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
'güncelle
For Each ara In s2.Range("k3:k" & s2.Cells(65536, 2).End(xlUp).Row)
If StrConv(ara.Value, vbUpperCase) = StrConv(TextBox10.Text * 1, vbUpperCase) Then
MsgBox "BU KİMLİK NO'LU KAYIT VAR"
Exit Sub
End If
If StrConv(ara.Value, vbUpperCase) <> StrConv(TextBox10.Text * 1, vbUpperCase) Then
'Yeni kayit ekle
say = s2.Cells(65536, 2).End(xlUp).Row
s2.Cells(say + 1, "A").Value = s2.Cells(say, "A").Value + 1 * 1
s2.Cells(say + 1, "B").Value = Evaluate("=PROPER(""" & ComboBox3.Value & """)")
s2.Cells(say + 1, "C").Value = Evaluate("=UPPER(""" & ComboBox4.Value & """)")
s2.Cells(say + 1, "D").Value = Evaluate("=PROPER(""" & TextBox3.Value & """)")
s2.Cells(say + 1, "E").Value = Evaluate("=UPPER(""" & TextBox4.Value & """)")
s2.Cells(say + 1, "F").Value = Evaluate("=PROPER(""" & TextBox5.Value & """)")
s2.Cells(say + 1, "G").Value = Evaluate("=PROPER(""" & TextBox6.Value & """)")
s2.Cells(say + 1, "H").Value = TextBox7.Value
s2.Cells(say + 1, "I").Value = Evaluate("=PROPER(""" & TextBox8.Value & """)")
s2.Cells(say + 1, "J").Value = Evaluate("=PROPER(""" & TextBox9.Value & """)")
s2.Cells(say + 1, "K").Value = Format(TextBox10.Value, "### ### ### ##")
s2.Cells(say + 1, "L").Value = ComboBox1.Value 'ŞUBE KD
s2.Cells(say + 1, "M").Value = TextBox11.Value 'HESAP NO
s2.Cells(say + 1, "N").Value = TextBox12.Value
s2.Cells(say + 1, "O").Value = ComboBox2.Value
s2.Cells(say + 1, "P").Value = TextBox14.Value
s2.Cells(say + 1, "Q").Value = TextBox15.Value
s2.Cells(say + 1, "R").Value = TextBox16.Value
s2.Cells(say + 1, "S").Value = TextBox17.Value
s2.Cells(say + 1, "A").Value = s2.Cells(say + 1, "A").Value & "."
MsgBox " Yeni Kaydiniz Eklendi"
Exit Sub
End If
Next ara
'SonKelime = Evaluate("=PROPER(""" & SonKelime & """)")
'Soyad = Evaluate("=UPPER(""" & Soyad & """)")
End Sub
Private Sub CommandButton10_Click()
If ComboBox5.Value = "Ücret Bordrosu" Then
Call UcrBrdWrd
ElseIf ComboBox5.Value = "Banka Listesi" Then
Call BankLıstWrd
ElseIf ComboBox5.Value = "Aylık Liste" Then
Call AyLıstWrd
End If
End Sub
Private Sub CommandButton11_Click()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
'güncelle
For Each ara In s2.Range("k3:k" & s2.Cells(65536, 2).End(xlUp).Row)
If StrConv(ara.Value, vbUpperCase) = StrConv(TextBox10.Text * 1, vbUpperCase) Then
s2.Select
s2.Range(ara.Offset(0, -9).Address).Value = ComboBox3.Value
s2.Range(ara.Offset(0, -8).Address).Value = ComboBox4.Value
s2.Range(ara.Offset(0, -7).Address).Value = TextBox3.Value
s2.Range(ara.Offset(0, -6).Address).Value = TextBox4.Value
s2.Range(ara.Offset(0, -5).Address).Value = TextBox5.Value
s2.Range(ara.Offset(0, -4).Address).Value = TextBox6.Value
s2.Range(ara.Offset(0, -3).Address).Value = TextBox7.Value
s2.Range(ara.Offset(0, -2).Address).Value = TextBox8.Value
s2.Range(ara.Offset(0, -1).Address).Value = TextBox9.Value
s2.Range(ara.Offset(0, 0).Address).Value = TextBox10.Value
s2.Range(ara.Offset(0, 1).Address).Value = ComboBox1.Value
s2.Range(ara.Offset(0, 2).Address).Value = TextBox11.Value
s2.Range(ara.Offset(0, 3).Address).Value = TextBox12.Value
s2.Range(ara.Offset(0, 4).Address).Value = ComboBox2.Value
s2.Range(ara.Offset(0, 5).Address).Value = TextBox14.Value
s2.Range(ara.Offset(0, 6).Address).Value = TextBox15.Value
s2.Range(ara.Offset(0, 7).Address).Value = TextBox16.Value
s2.Range(ara.Offset(0, 17).Address).Value = TextBox17.Value
MsgBox " Bilgileriniz Guncellendi"
Exit Sub
End If
Next ara
'SonKelime = Evaluate("=PROPER(""" & SonKelime & """)")
'Soyad = Evaluate("=UPPER(""" & Soyad & """)")
End Sub
Private Sub CommandButton2_Click()
TEMIZLE1
End Sub
Private Sub CommandButton3_Click()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
say = s3.Cells(65536, 2).End(xlUp).Row
s3.Range("B7:Z" & say + 7).ClearContents
say1 = s4.Cells(65536, 2).End(xlUp).Row
s4.Range("B5:Z" & say + 7).ClearContents
say2 = s5.Cells(65536, 2).End(xlUp).Row
s5.Range("B3:Z" & say + 7).ClearContents
End Sub
Private Sub CommandButton4_Click()
Unload Me
End Sub
Private Sub CommandButton5_Click()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
s1.Range("b65536").End(xlUp).Offset(1, 0).Value = ComboBox1
say = s3.Cells(65536, 2).End(xlUp).Row
s3.Range("B7:Z" & say + 7).ClearContents
say1 = s4.Cells(65536, 2).End(xlUp).Row
s4.Range("B5:Z" & say + 7).ClearContents
say2 = s5.Cells(65536, 2).End(xlUp).Row
s5.Range("B3:Z" & say + 7).ClearContents
'ücret bodrosu
For i = 3 To s2.Cells(65536, 2).End(xlUp).Row
s2.Range("b" & i & ":e" & i).Copy
s3.Range("b65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
s2.Range("k" & i).Copy
s3.Range("b65536").End(xlUp).Offset(0, 4).PasteSpecial xlPasteValues
s2.Range("n" & i).Copy
s3.Range("b65536").End(xlUp).Offset(0, 5).PasteSpecial xlPasteValues
s2.Range("p" & i & ":s" & i).Copy
s3.Range("b65536").End(xlUp).Offset(0, 6).PasteSpecial xlPasteValues
Next i
'Ay_Listesi
For i = 3 To s2.Cells(65536, 2).End(xlUp).Row
s2.Range("b" & i & ":K" & i).Copy
s4.Range("b65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
s2.Range("Q" & i).Copy
s4.Range("b65536").End(xlUp).Offset(0, 10).PasteSpecial xlPasteValues
Next i
'Ay_Listesi
For i = 3 To s2.Cells(65536, 2).End(xlUp).Row
s2.Range("D" & i & ":E" & i).Copy
s5.Range("b65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
s2.Range("O" & i).Copy
s5.Range("b65536").End(xlUp).Offset(0, 2).PasteSpecial xlPasteValues
s2.Range("Q" & i).Copy
s5.Range("b65536").End(xlUp).Offset(0, 3).PasteSpecial xlPasteValues
s2.Range("L" & i & ":M" & i).Copy
s5.Range("b65536").End(xlUp).Offset(0, 4).PasteSpecial xlPasteValues
Next i
End Sub
Private Sub CommandButton6_Click()
Application.ScreenUpdating = False
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
If Not ComboBox4 = "" Then Exit Sub
For Each ara In s2.Range("b1:b" & s2.Cells(65536, 2).End(xlUp).Row)
If StrConv(ara.Value, vbUpperCase) = StrConv(ComboBox3.Value, vbUpperCase) Then
s2.Select
ComboBox4.Value = s2.Range(ara.Offset(0, 1).Address).Value
TextBox3.Value = s2.Range(ara.Offset(0, 2).Address).Value
TextBox4.Value = s2.Range(ara.Offset(0, 3).Address).Value
TextBox5.Value = s2.Range(ara.Offset(0, 4).Address).Value
TextBox6.Value = s2.Range(ara.Offset(0, 5).Address).Value
TextBox7.Value = s2.Range(ara.Offset(0, 6).Address).Value
TextBox8.Value = s2.Range(ara.Offset(0, 7).Address).Value
TextBox9.Value = s2.Range(ara.Offset(0, 8).Address).Value
TextBox10.Value = s2.Range(ara.Offset(0, 9).Address).Value
ComboBox1.Value = s2.Range(ara.Offset(0, 10).Address).Value
TextBox11.Value = s2.Range(ara.Offset(0, 11).Address).Value
TextBox12.Value = s2.Range(ara.Offset(0, 12).Address).Value
ComboBox2.Value = s2.Range(ara.Offset(0, 13).Address).Value
TextBox14.Value = s2.Range(ara.Offset(0, 14).Address).Value
TextBox15.Value = s2.Range(ara.Offset(0, 15).Address).Value
TextBox16.Value = s2.Range(ara.Offset(0, 16).Address).Value
TextBox17.Value = s2.Range(ara.Offset(0, 17).Address).Value
Exit Sub
End If
Next ara
End Sub
Private Sub TextBox14_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Dim toplam, toplam1, toplam2, toplam3 As Double
If TextBox12 = "" Then Exit Sub
If TextBox14 = "" Then Exit Sub
toplam = Val(TextBox12)
toplam1 = CDbl(TextBox14)
toplam2 = toplam * toplam1
TextBox15.Value = FormatNumber(toplam2, 2)
On Error GoTo 0
End Sub
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
ComboBox5.AddItem "Ücret Bordrosu"
ComboBox5.AddItem "Banka Listesi"
ComboBox5.AddItem "Aylık Liste"
ComboBox5.Style = fmStyleDropDownList
'On Error Resume Next
Dim say As Long, say1 As Long, say3 As Long
Dim s1 As Worksheet, s2 As Worksheet, s3 As Worksheet, s4 As Worksheet
Dim ADOSYA As String
ADOSYA = ThisWorkbook.Name
Windows(ADOSYA).Activate
Set s1 = ThisWorkbook.Worksheets("veri")
Set s2 = ThisWorkbook.Worksheets("Bilgi_Girisi")
Set s3 = ThisWorkbook.Worksheets("Ucret_Bodrosu")
Set s4 = ThisWorkbook.Worksheets("Ay_Listesi")
Set s5 = ThisWorkbook.Worksheets("Banka_Listesi")
Dim i%
Dim TMP$
ComboBox2.Clear
For i = 1 To 12
TMP = Format(DateSerial(2004, i, 1), "mmmm")
ComboBox2.AddItem TMP
Next i
say = s2.Cells(65536, 2).End(xlUp).Row
s2.Select
ComboBox3.ColumnCount = 2
ComboBox3.ColumnWidths = "30;50"
ComboBox3.ListRows = "5"
ComboBox3.RowSource = "Bilgi_Girisi!b3: C" & Cells(65536, 2).End(xlUp).Row
'ComboBox4.RowSource = "Bilgi_Girisi!c3: c" & Cells(65536, 3).End(xlUp).Row
ComboBox1.ColumnCount = 2
ComboBox1.ColumnWidths = "30;50"
ComboBox1.ListRows = "5"
ComboBox1.RowSource = "veri!a2: b" & s1.Cells(65536, 1).End(xlUp).Row
TextBox16.Value = "12.MADDE"
Application.ScreenUpdating = True
End Sub
Private Sub TEMIZLE1()
Application.ScreenUpdating = False
'On Error Resume Next
Application.ScreenUpdating = False
For Each NESNE1 In Controls
If TypeName(NESNE1) = "TextBox" Then ' NESNENIN ADI YAZILACAK
NESNE1.Value = ""
End If
Next NESNE1
For Each nesne In Controls
If TypeName(nesne) = "ComboBox" Then ' NESNENIN ADI YAZILACAK
nesne.Value = ""
End If
Next nesne
'For Each nesne2 In Controls
'If TypeName(nesne2) = "ListBox" Then ' NESNENIN ADI YAZILACAK
'nesne2.RowSource = ""
'End If
'Next nesne2
TextBox16.Value = "MADDE 12"
End Sub
değişen dosyanız ekte...