- Katılım
- 11 Ağustos 2005
- Mesajlar
- 239
ARKADAŞLAR AŞAĞIDAKİ KODUN HER ZAMAN SAYFA1 DE ÇALIŞMASINI NASIL YAPARIM
TEŞEKKÜRLER
Private Sub CommandButton1_Click()
For a = 1 To 8
If Controls("textbox" & a) = "" Then
MsgBox "VERİ GİRİŞİ EKSİKTİR"
Exit Sub
End If
Next
sonsat = [a65536].End(3).Row + 1
Cells(sonsat, 1) = sonsat - 1
Cells(sonsat, 2) = TextBox1
Cells(sonsat, 3) = TextBox2
Cells(sonsat, 4) = TextBox3
Cells(sonsat, 5) = TextBox4
Cells(sonsat, 6) = TextBox5
Cells(sonsat, 7) = TextBox6
Cells(sonsat, 8) = TextBox7
Cells(sonsat, 9) = CLng(CDate(TextBox8))
UserForm_Initialize
ListBox1.ListIndex = sonsat - 2
End Sub
Private Sub CommandButton2_Click()
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sonsat = ListBox1.ListIndex + 2
Cells(sonsat, 2) = TextBox1
Cells(sonsat, 3) = TextBox2
Cells(sonsat, 4) = TextBox3
Cells(sonsat, 5) = TextBox4
Cells(sonsat, 6) = TextBox5
Cells(sonsat, 7) = TextBox6
Cells(sonsat, 8) = TextBox7
Cells(sonsat, 9) = CLng(CDate(TextBox8))
ListBox1.RowSource = "B2:I" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub
Private Sub CommandButton3_Click()
sor = MsgBox("Silmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sat = ListBox1.ListIndex + 2
Range("B" & sat & ":I" & sat).Delete
[a65536].End(3).ClearContents
Range("a2:j" & [a65536].End(3).Row).Interior.ColorIndex = xlNone
UserForm_Initialize
CommandButton5_Click
MsgBox "SEÇİLEN VERİ SİLİNMİŞTİR"
End Sub
Private Sub CommandButton5_Click()
CommandButton1.Enabled = True
CommandButton2.Enabled = False
CommandButton3.Enabled = False
For a = 1 To 8
Controls("textbox" & a) = ""
Next
ListBox1.ListIndex = -1
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
For a = 0 To 6
Controls("textbox" & a + 1) = ListBox1.Column(a)
Next
TextBox8 = Format(ListBox1.Column(7), "dd.mm.yyyy")
sat = ListBox1.ListIndex + 2
Range("A" & sat & ":I" & sat).Interior.ColorIndex = 6
CommandButton1.Enabled = False
CommandButton2.Enabled = True
CommandButton3.Enabled = True
End Sub
Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox8 = Format(TextBox8, "dd.mm.yyyy")
End Sub
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 8
ListBox1.ColumnWidths = "50;80;70;60;50;70;50;50"
ListBox1.RowSource = "B2:I" & [a65536].End(3).Row
CommandButton2.Enabled = False
CommandButton3.Enabled = False
Me.Top = 40
Me.Left = 80
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Range("a2:j65536").Interior.ColorIndex = xlNone
End Sub
TEŞEKKÜRLER
Private Sub CommandButton1_Click()
For a = 1 To 8
If Controls("textbox" & a) = "" Then
MsgBox "VERİ GİRİŞİ EKSİKTİR"
Exit Sub
End If
Next
sonsat = [a65536].End(3).Row + 1
Cells(sonsat, 1) = sonsat - 1
Cells(sonsat, 2) = TextBox1
Cells(sonsat, 3) = TextBox2
Cells(sonsat, 4) = TextBox3
Cells(sonsat, 5) = TextBox4
Cells(sonsat, 6) = TextBox5
Cells(sonsat, 7) = TextBox6
Cells(sonsat, 8) = TextBox7
Cells(sonsat, 9) = CLng(CDate(TextBox8))
UserForm_Initialize
ListBox1.ListIndex = sonsat - 2
End Sub
Private Sub CommandButton2_Click()
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sonsat = ListBox1.ListIndex + 2
Cells(sonsat, 2) = TextBox1
Cells(sonsat, 3) = TextBox2
Cells(sonsat, 4) = TextBox3
Cells(sonsat, 5) = TextBox4
Cells(sonsat, 6) = TextBox5
Cells(sonsat, 7) = TextBox6
Cells(sonsat, 8) = TextBox7
Cells(sonsat, 9) = CLng(CDate(TextBox8))
ListBox1.RowSource = "B2:I" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub
Private Sub CommandButton3_Click()
sor = MsgBox("Silmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sat = ListBox1.ListIndex + 2
Range("B" & sat & ":I" & sat).Delete
[a65536].End(3).ClearContents
Range("a2:j" & [a65536].End(3).Row).Interior.ColorIndex = xlNone
UserForm_Initialize
CommandButton5_Click
MsgBox "SEÇİLEN VERİ SİLİNMİŞTİR"
End Sub
Private Sub CommandButton5_Click()
CommandButton1.Enabled = True
CommandButton2.Enabled = False
CommandButton3.Enabled = False
For a = 1 To 8
Controls("textbox" & a) = ""
Next
ListBox1.ListIndex = -1
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
For a = 0 To 6
Controls("textbox" & a + 1) = ListBox1.Column(a)
Next
TextBox8 = Format(ListBox1.Column(7), "dd.mm.yyyy")
sat = ListBox1.ListIndex + 2
Range("A" & sat & ":I" & sat).Interior.ColorIndex = 6
CommandButton1.Enabled = False
CommandButton2.Enabled = True
CommandButton3.Enabled = True
End Sub
Private Sub TextBox8_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox8 = Format(TextBox8, "dd.mm.yyyy")
End Sub
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 8
ListBox1.ColumnWidths = "50;80;70;60;50;70;50;50"
ListBox1.RowSource = "B2:I" & [a65536].End(3).Row
CommandButton2.Enabled = False
CommandButton3.Enabled = False
Me.Top = 40
Me.Left = 80
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Range("a2:j65536").Interior.ColorIndex = xlNone
End Sub