Kaydetmede hata

Katılım
7 Mart 2007
Mesajlar
60
Excel Vers. ve Dili
Excel 2003 almanca
Saygilar Yaptigim userform calismasinda excel sayfasindaki 16 siraya kadar kayit yapiyor sonrasi kaydetmiyor acaba hata nerde

[/URL] [/IMG]

Private Sub ComboBox1_Change()
Application.ScreenUpdating = False
If ActiveSheet.AutoFilterMode = False Then [a1:b65536].AutoFilter
[a1:b65536].AutoFilter Field:=1, Criteria1:=ComboBox1
say = WorksheetFunction.Subtotal(102, [a:a])
If say = 1 Then
sat = [a65536].End(3).Row
For a = 3 To 10
Controls("textbox" & a - 2) = Cells(sat, a)
Next
End If
End Sub
Private Sub ComboBox2_Change()
Application.ScreenUpdating = False
If ActiveSheet.AutoFilterMode = False Then [a1:b65536].AutoFilter
[a1:b65536].AutoFilter Field:=2, Criteria1:=ComboBox2
say = WorksheetFunction.Subtotal(102, [a:a])
If say = 1 Then
sat = [a65536].End(3).Row
evn = WorksheetFunction.CountA(Range("A1:IV" & Range("a1").End(xlToRight).Row))
For a = 3 To evn
Controls("textbox" & a - 2) = Cells(sat, a)
Next
End If
End Sub

Private Sub CommandButton1_Click()
Dim bak As Range
Dim say As Integer
For Each bak In Range("A1:A" & WorksheetFunction.CountA(Range("A1:A65000")))
If bak.Value = ComboBox1.Value Then
Exit Sub
End If
Next bak
For Each bak In Range("B1:B" & WorksheetFunction.CountA(Range("B1:B65000")))
If bak.Value = ComboBox2.Value Then
Exit Sub

End If

Next bak

say = WorksheetFunction.CountA(Range("a1:a65000"))


Cells(say + 1, 1).Value = ComboBox1.Value
Cells(say + 1, 2).Value = ComboBox2.Value
Cells(say + 1, 3).Value = TextBox1.Value
Cells(say + 1, 4).Value = TextBox2.Value
Cells(say + 1, 5).Value = TextBox3.Value
Cells(say + 1, 6).Value = TextBox4.Value
Cells(say + 1, 7).Value = TextBox5.Value
Cells(say + 1, 8).Value = TextBox6.Value
Cells(say + 1, 9).Value = TextBox7.Value
Cells(say + 1, 10).Value = TextBox8.Value
Cells(say + 1, 11).Value = TextBox9.Value
Cells(say + 1, 12).Value = TextBox10.Value
Cells(say + 1, 13).Value = TextBox11.Value
Cells(say + 1, 14).Value = TextBox12.Value
Cells(say + 1, 15).Value = TextBox13.Value
Cells(say + 1, 16).Value = TextBox14.Value
Cells(say + 1, 17).Value = TextBox15.Value
Cells(say + 1, 18).Value = TextBox16.Value
Cells(say + 1, 19).Value = TextBox17.Value
Cells(say + 1, 20).Value = TextBox18.Value
Cells(say + 1, 21).Value = TextBox19.Value
Cells(say + 1, 22).Value = TextBox20.Value
Cells(say + 1, 23).Value = TextBox21.Value
Cells(say + 1, 24).Value = TextBox22.Value
Cells(say + 1, 25).Value = TextBox23.Value
Cells(say + 1, 26).Value = TextBox24.Value




MsgBox "Verileriniz Kaydedildi", , "KAYIT"

End Sub

Private Sub CommandButton2_Click()
ComboBox1.Value = ""
ComboBox2.Value = ""
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
TextBox9.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
TextBox12.Value = ""
TextBox13.Value = ""
TextBox14.Value = ""
TextBox15.Value = ""
TextBox16.Value = ""
TextBox17.Value = ""
TextBox18.Value = ""
TextBox19.Value = ""
TextBox20.Value = ""
TextBox21.Value = ""
TextBox22.Value = ""
TextBox23.Value = ""
TextBox24.Value = ""
ComboBox1.SetFocus
ComboBox2.SetFocus
End Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
For a = 1 To 12
ComboBox1.AddItem 2006 + a
ComboBox2.AddItem Format(DateSerial(2007, a, 1), "mmmm")
Next
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
[a1:b65536].AutoFilter
End Sub
 

Ekli dosyalar

Son düzenleme:
Katılım
20 Nisan 2007
Mesajlar
5
Excel Vers. ve Dili
Excel XP
Excel 2003
Excel 2007
form u çağıran kod u

userform1.show 0

şeklinde değişin.

"combobox 1" boş kalmadıkça kayıt yapar.
bu kodlar kaydı "A" sütununda ki boşluğa bakarak yapar.

aşağıdaki kodlar "a" ve "b" sütununda aynı satırda bulunan verilere göre combo1 ve combo2 verileri aynı ise kaydetmeden çıkar.

Dim bak As Range
Dim say As Integer
For Each bak In Range("A1:A" & WorksheetFunction.CountA(Range("A1:A65000")))
If bak.Value = ComboBox1.Value Then
Exit Sub
End If
Next bak
For Each bak In Range("B1:B" & WorksheetFunction.CountA(Range("B1:B65000")))
If bak.Value = ComboBox2.Value Then
Exit Sub
 
Son düzenleme:
Katılım
20 Nisan 2007
Mesajlar
5
Excel Vers. ve Dili
Excel XP
Excel 2003
Excel 2007
kayıtta döngü leri kullanmanızı tavsiye ederim.
 
Son düzenleme:
Üst