Kaydet Butonun da Yavaşlama

Katılım
22 Temmuz 2006
Mesajlar
186
Excel Vers. ve Dili
2003
Arkadaşlar hepinize kolay gelsin. Yaptığım bir excell sayfamın üzerinde 1 Userform var ve KAYDET butonunda da aşağıdaki kodlar var. Sorun Sayfa üzerinde veriler artınca bu buton bekletiyor .

Listbox1 e Textbox1 deki tarihe göre veriler alıyorum ve geçmiş tarihi girincede
eski veriler geliyor. Burda DÜZELT ve SİL komunu kullanabiliyorum ama anladığım kadarıyla Listbox1 e Textbox1 deki tarihe göre veriler almam beni yavaşaltıyor

Sizden istediğim bu kodları nasıl hızlandırabilirim acaba . .

Private Sub kaydet_Click()
On Error Resume Next
Sheets("sayfa1").Activate
For a = 1 To 8
If Controls("textbox" & a) = "" Then
MsgBox "Lütfen Tüm Verileri Doldurun !! ", vbInformation, "Hata "
Exit Sub
End If
Next
erhan = [a65536].End(3).Row + 1
Cells(erhan, 1) = CDate(Format(TextBox1, "dd.mm.yyyy"))
Cells(erhan, 2) = TextBox2
Cells(erhan, 3) = TextBox3
Cells(erhan, 4) = TextBox4.Text * 1
Cells(erhan, 5) = TextBox5.Text * 1
Cells(erhan, 6) = TextBox6.Text * 1
Cells(erhan, 7) = TextBox7.Text * 1
Cells(erhan, 8) = TextBox8.Text * 1

TextBox12 = Sheets("sayfa2").[k4]
TextBox12.Value = Replace(TextBox12.Value, ".", ",")
TextBox11.Value = Format(TextBox11, "#.0000")

TextBox11 = Sheets("sayfa2").[k7]
TextBox11.Value = Replace(TextBox11.Value, ".", ",")
TextBox11.Value = Format(TextBox11, "#.00")

TextBox10 = Sheets("sayfa2").[k8]
TextBox10.Value = Replace(TextBox10.Value, ".", ",")
TextBox10.Value = Format(TextBox10, "#.00")

TextBox9 = Sheets("sayfa2").[k9]
TextBox9.Value = Replace(TextBox9.Value, ".", ",")
TextBox9.Value = Format(TextBox9, "#.00")

erhn = TextBox1


ListBox1.RowSource = Empty
ListBox1.Clear
ListBox1.ColumnCount = 9
For Each isim In Sheets("Sayfa1").Range("a2:a" & Sheets("Sayfa1").Range("a65536").End(xlUp).Row)
If UCase(LCase(isim)) Like UCase(LCase(erhn)) & "*" Then
liste = ListBox1.ListCount
ListBox1.AddItem
ListBox1.List(liste, 0) = isim
ListBox1.List(liste, 1) = isim.Offset(0, 1)
ListBox1.List(liste, 2) = isim.Offset(0, 2)
ListBox1.List(liste, 3) = isim.Offset(0, 3)
ListBox1.List(liste, 4) = isim.Offset(0, 4)
ListBox1.List(liste, 5) = isim.Offset(0, 5)
ListBox1.List(liste, 6) = isim.Offset(0, 6)
ListBox1.List(liste, 7) = isim.Offset(0, 7)
ListBox1.List(liste, 8) = isim.Offset(0, 8)
End If
Next
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox2.SetFocus
ListBox1.ListIndex = ListBox1.ListCount - 1
End Sub
 

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,057
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Yavaşlamaya neden olan kısım listboxa veri alınan döngüdür. Bu döngü için bir alternatif üretilebilir, ama bunun için bize ne yapmak istediğinizi anlatın veya örnek bir dosya ekleyin.
 
Üst