Arkadaslar merhaba, bir calısmam için daha onceden RİPEK arkadaşımız hazırlamıs oldugu bir user form calısmasına ait kodlar asagıdaki gibidir. Bu formun yapısı tam benım calısmama uygundur yalnız tum gunumu harcadıgım halde kendı ısteklerıme yanıt verecek duzeltmelerı yapamadım. Bu aşagıdaki kodları bıkmadan kısaca acıklayabilecek bir arkadas olur ise ogrenme acısından hepimiz icin iyi bir kaynak olur ve belki bende sorularımın yanıtını bulurum bu acıklamaları irdeleyerek. Sorunum kodların nasıl calıstıgını daha dogrusu ne işlev yaptıgını bulamamam. Teşekkurler
Private Sub ALAN01_Change()
On Error Resume Next
L03.Caption = ALAN01.Value
End Sub
Private Sub ALAN06_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN06.Value = Format(ALAN06.Value, "##,##0.00")
End Sub
Private Sub ALAN07_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN07.Value = Format(ALAN07.Value, "dd.mm.yyyy")
End Sub
Private Sub ALAN08_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN08.Value = Format(ALAN08.Value, "dd.mm.yyyy")
End Sub
Private Sub B01_Click()
On Error Resume Next
ALAN01.Value = L05.Caption + 1
Call EkranYeniKayıt
ALAN02.SetFocus
kayıt = True
End Sub
Private Sub B02_Click()
On Error Resume Next
If kayıt = True Then
Call SonKayıt
Call VeriKaydet
Call EkranKaydet
Else
Call VeriKaydet
Call EkranKaydet
End If
kayıt = False
End Sub
Private Sub B03_Click()
On Error Resume Next
Range("A2").Select
Call VeriAl
End Sub
Private Sub B04_Click()
On Error Resume Next
If IsNumeric(ActiveCell.Offset(-1, 0).Value) = True Then
ActiveCell.Offset(-1, 0).Select
Call VeriAl
Else
MsgBox "İlk Kayıt"
Exit Sub
End If
End Sub
Private Sub B05_Click()
On Error Resume Next
If ActiveCell.Offset(1, 0).Value <> "" Then
ActiveCell.Offset(1, 0).Select
Call VeriAl
Else
MsgBox "Son Kayıt"
Exit Sub
End If
End Sub
Private Sub B06_Click()
On Error Resume Next
Call SonKayıt
ActiveCell.Offset(-1, 0).Select
Call VeriAl
End Sub
Private Sub B07_Click()
On Error Resume Next
Call EkranKaydet
End Sub
Private Sub B08_Click()
On Error Resume Next
Dim alan, ara, sayi As Variant
ara = InputBox("Aramak İstediğiniz Kaydın Sıra Numarasını Giriniz.", "OZIPER")
sayi = Val(ara)
Set alan = Range("A1:A1001").Find(sayi)
If alan Is Nothing Then
MsgBox "Aradığınız Kayıt Bulunamadı.", vbCritical + vbDefaultButton1 + vbOKOnly, "UYARI"
Exit Sub
Else
alan.Select
Call VeriAl
End If
ALAN02.SetFocus
End Sub
Private Sub B09_Click()
On Error Resume Next
Call EkranYeniKayıt
B10.Enabled = True
End Sub
Private Sub B10_Click()
On Error Resume Next
If (MsgBox("İlgili Kayıtı Silmek İstiyormusunuz?", vbCritical + vbDefaultButton2 + vbYesNo, "UYARI")) = vbYes Then
Range(ActiveCell, ActiveCell.Offset(0, 11)).Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
If ActiveCell.Value = "" Then ActiveCell.Offset(-1, 0).Select
Call VeriAl
MsgBox "İlgili Kayıt Silindi.", vbCritical + vbDefaultButton1 + vbOKOnly, "UYARI"
Else
Exit Sub
End If
Call EkranKaydet
End Sub
Private Sub B11_Click()
On Error Resume Next
UserForm2.Show
End Sub
Private Sub B12_Click()
On Error Resume Next
Unload Me
End Sub
Sub SonKayıt()
On Error Resume Next
Range("A2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Sub SıraNoVer()
On Error Resume Next
If IsNumeric(ActiveCell.Offset(-1, 0).Value) = True Then
Me.A01.Value = ActiveCell.Offset(-1, 0).Value + 1
Else
Me.A01.Value = 1
End If
End Sub
Private Sub UserForm_Initialize()
On Error Resume Next
ALAN01.SetFocus
Call SonKayıt
ActiveCell.Offset(-1, 0).Select
Call EkranKaydet
Call VeriAl
kayıt = False
End Sub
Sub EkranKaydet()
On Error Resume Next
'ALAN01.Enabled = False
ALAN02.Enabled = False
ALAN03.Enabled = False
ALAN04.Enabled = False
ALAN05.Enabled = False
ALAN06.Enabled = False
ALAN07.Enabled = False
ALAN08.Enabled = False
ALAN09.Enabled = False
ALAN10.Enabled = False
ALAN11.Enabled = False
ALAN12.Enabled = False
O01.Enabled = False
B01.Enabled = True
B02.Enabled = False
B03.Enabled = True
B04.Enabled = True
B05.Enabled = True
B06.Enabled = True
B07.Enabled = False
B08.Enabled = True
B09.Enabled = True
B10.Enabled = False
B11.Enabled = True
B12.Enabled = True
Toplam = Application.WorksheetFunction.CountA([A2:A500])
L05.Caption = Toplam
End Sub
Sub EkranYeniKayıt()
On Error Resume Next
'ALAN01.Enabled = False
ALAN02.Enabled = True
ALAN03.Enabled = True
ALAN04.Enabled = True
ALAN05.Enabled = True
ALAN06.Enabled = True
ALAN07.Enabled = True
ALAN08.Enabled = True
ALAN09.Enabled = True
ALAN10.Enabled = True
ALAN11.Enabled = True
ALAN12.Enabled = True
O01.Enabled = True
B01.Enabled = False
B02.Enabled = True
B03.Enabled = False
B04.Enabled = False
B05.Enabled = False
B06.Enabled = False
B07.Enabled = True
B08.Enabled = False
B09.Enabled = False
B10.Enabled = False
B11.Enabled = True
B12.Enabled = False
End Sub
Sub VeriKaydet()
ActiveCell.Value = ALAN01.Value
ActiveCell.Offset(0, 1).Value = ALAN02.Value
ActiveCell.Offset(0, 2).Value = ALAN03.Value
ActiveCell.Offset(0, 3).Value = ALAN04.Value
ActiveCell.Offset(0, 4).Value = ALAN05.Value
ActiveCell.Offset(0, 5).Value = Val(ALAN06.Value) * 1
ActiveCell.Offset(0, 6).Value = ALAN07.Value
ActiveCell.Offset(0, 7).Value = ALAN08.Value
ActiveCell.Offset(0, 8).Value = ALAN09.Value
ActiveCell.Offset(0, 9).Value = ALAN10.Value
ActiveCell.Offset(0, 10).Value = ALAN11.Value
ActiveCell.Offset(0, 11).Value = ALAN12.Value
End Sub
Sub VeriAl()
ALAN01.Value = ActiveCell.Value
ALAN02.Value = ActiveCell.Offset(0, 1).Value
ALAN03.Value = ActiveCell.Offset(0, 2).Value
ALAN04.Value = ActiveCell.Offset(0, 3).Value
ALAN05.Value = ActiveCell.Offset(0, 4).Value
ALAN06.Value = Format(ActiveCell.Offset(0, 5).Value, "##,##0.00")
ALAN07.Value = Format(ActiveCell.Offset(0, 6).Value, "dd.mm.yyyy")
ALAN08.Value = Format(ActiveCell.Offset(0, 7).Value, "dd.mm.yyyy")
ALAN09.Value = ActiveCell.Offset(0, 8).Value
ALAN10.Value = ActiveCell.Offset(0, 9).Value
ALAN11.Value = ActiveCell.Offset(0, 10).Value
ALAN12.Value = ActiveCell.Offset(0, 11).Value
End Sub
Private Sub ALAN01_Change()
On Error Resume Next
L03.Caption = ALAN01.Value
End Sub
Private Sub ALAN06_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN06.Value = Format(ALAN06.Value, "##,##0.00")
End Sub
Private Sub ALAN07_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN07.Value = Format(ALAN07.Value, "dd.mm.yyyy")
End Sub
Private Sub ALAN08_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
ALAN08.Value = Format(ALAN08.Value, "dd.mm.yyyy")
End Sub
Private Sub B01_Click()
On Error Resume Next
ALAN01.Value = L05.Caption + 1
Call EkranYeniKayıt
ALAN02.SetFocus
kayıt = True
End Sub
Private Sub B02_Click()
On Error Resume Next
If kayıt = True Then
Call SonKayıt
Call VeriKaydet
Call EkranKaydet
Else
Call VeriKaydet
Call EkranKaydet
End If
kayıt = False
End Sub
Private Sub B03_Click()
On Error Resume Next
Range("A2").Select
Call VeriAl
End Sub
Private Sub B04_Click()
On Error Resume Next
If IsNumeric(ActiveCell.Offset(-1, 0).Value) = True Then
ActiveCell.Offset(-1, 0).Select
Call VeriAl
Else
MsgBox "İlk Kayıt"
Exit Sub
End If
End Sub
Private Sub B05_Click()
On Error Resume Next
If ActiveCell.Offset(1, 0).Value <> "" Then
ActiveCell.Offset(1, 0).Select
Call VeriAl
Else
MsgBox "Son Kayıt"
Exit Sub
End If
End Sub
Private Sub B06_Click()
On Error Resume Next
Call SonKayıt
ActiveCell.Offset(-1, 0).Select
Call VeriAl
End Sub
Private Sub B07_Click()
On Error Resume Next
Call EkranKaydet
End Sub
Private Sub B08_Click()
On Error Resume Next
Dim alan, ara, sayi As Variant
ara = InputBox("Aramak İstediğiniz Kaydın Sıra Numarasını Giriniz.", "OZIPER")
sayi = Val(ara)
Set alan = Range("A1:A1001").Find(sayi)
If alan Is Nothing Then
MsgBox "Aradığınız Kayıt Bulunamadı.", vbCritical + vbDefaultButton1 + vbOKOnly, "UYARI"
Exit Sub
Else
alan.Select
Call VeriAl
End If
ALAN02.SetFocus
End Sub
Private Sub B09_Click()
On Error Resume Next
Call EkranYeniKayıt
B10.Enabled = True
End Sub
Private Sub B10_Click()
On Error Resume Next
If (MsgBox("İlgili Kayıtı Silmek İstiyormusunuz?", vbCritical + vbDefaultButton2 + vbYesNo, "UYARI")) = vbYes Then
Range(ActiveCell, ActiveCell.Offset(0, 11)).Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
If ActiveCell.Value = "" Then ActiveCell.Offset(-1, 0).Select
Call VeriAl
MsgBox "İlgili Kayıt Silindi.", vbCritical + vbDefaultButton1 + vbOKOnly, "UYARI"
Else
Exit Sub
End If
Call EkranKaydet
End Sub
Private Sub B11_Click()
On Error Resume Next
UserForm2.Show
End Sub
Private Sub B12_Click()
On Error Resume Next
Unload Me
End Sub
Sub SonKayıt()
On Error Resume Next
Range("A2").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Sub SıraNoVer()
On Error Resume Next
If IsNumeric(ActiveCell.Offset(-1, 0).Value) = True Then
Me.A01.Value = ActiveCell.Offset(-1, 0).Value + 1
Else
Me.A01.Value = 1
End If
End Sub
Private Sub UserForm_Initialize()
On Error Resume Next
ALAN01.SetFocus
Call SonKayıt
ActiveCell.Offset(-1, 0).Select
Call EkranKaydet
Call VeriAl
kayıt = False
End Sub
Sub EkranKaydet()
On Error Resume Next
'ALAN01.Enabled = False
ALAN02.Enabled = False
ALAN03.Enabled = False
ALAN04.Enabled = False
ALAN05.Enabled = False
ALAN06.Enabled = False
ALAN07.Enabled = False
ALAN08.Enabled = False
ALAN09.Enabled = False
ALAN10.Enabled = False
ALAN11.Enabled = False
ALAN12.Enabled = False
O01.Enabled = False
B01.Enabled = True
B02.Enabled = False
B03.Enabled = True
B04.Enabled = True
B05.Enabled = True
B06.Enabled = True
B07.Enabled = False
B08.Enabled = True
B09.Enabled = True
B10.Enabled = False
B11.Enabled = True
B12.Enabled = True
Toplam = Application.WorksheetFunction.CountA([A2:A500])
L05.Caption = Toplam
End Sub
Sub EkranYeniKayıt()
On Error Resume Next
'ALAN01.Enabled = False
ALAN02.Enabled = True
ALAN03.Enabled = True
ALAN04.Enabled = True
ALAN05.Enabled = True
ALAN06.Enabled = True
ALAN07.Enabled = True
ALAN08.Enabled = True
ALAN09.Enabled = True
ALAN10.Enabled = True
ALAN11.Enabled = True
ALAN12.Enabled = True
O01.Enabled = True
B01.Enabled = False
B02.Enabled = True
B03.Enabled = False
B04.Enabled = False
B05.Enabled = False
B06.Enabled = False
B07.Enabled = True
B08.Enabled = False
B09.Enabled = False
B10.Enabled = False
B11.Enabled = True
B12.Enabled = False
End Sub
Sub VeriKaydet()
ActiveCell.Value = ALAN01.Value
ActiveCell.Offset(0, 1).Value = ALAN02.Value
ActiveCell.Offset(0, 2).Value = ALAN03.Value
ActiveCell.Offset(0, 3).Value = ALAN04.Value
ActiveCell.Offset(0, 4).Value = ALAN05.Value
ActiveCell.Offset(0, 5).Value = Val(ALAN06.Value) * 1
ActiveCell.Offset(0, 6).Value = ALAN07.Value
ActiveCell.Offset(0, 7).Value = ALAN08.Value
ActiveCell.Offset(0, 8).Value = ALAN09.Value
ActiveCell.Offset(0, 9).Value = ALAN10.Value
ActiveCell.Offset(0, 10).Value = ALAN11.Value
ActiveCell.Offset(0, 11).Value = ALAN12.Value
End Sub
Sub VeriAl()
ALAN01.Value = ActiveCell.Value
ALAN02.Value = ActiveCell.Offset(0, 1).Value
ALAN03.Value = ActiveCell.Offset(0, 2).Value
ALAN04.Value = ActiveCell.Offset(0, 3).Value
ALAN05.Value = ActiveCell.Offset(0, 4).Value
ALAN06.Value = Format(ActiveCell.Offset(0, 5).Value, "##,##0.00")
ALAN07.Value = Format(ActiveCell.Offset(0, 6).Value, "dd.mm.yyyy")
ALAN08.Value = Format(ActiveCell.Offset(0, 7).Value, "dd.mm.yyyy")
ALAN09.Value = ActiveCell.Offset(0, 8).Value
ALAN10.Value = ActiveCell.Offset(0, 9).Value
ALAN11.Value = ActiveCell.Offset(0, 10).Value
ALAN12.Value = ActiveCell.Offset(0, 11).Value
End Sub