- Katılım
- 11 Ağustos 2005
- Mesajlar
- 239
arkadaşlar aşağıdaki makroda yavaşlamama sebeb ne olabilir bakarsanız sevinirim
Dim cmb(14) As New Class1
Private Sub ComboBox1_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h1").Value = ComboBox1.Value
ListBox2.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox1 Then
ListBox2.AddItem
ListBox2.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox2.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox23 = deg
TextBox23 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox10_Change()
Sheets("Sayfa1").Range("H10").Value = ComboBox10.Value
End Sub
Private Sub ComboBox11_Change()
Sheets("Sayfa1").Range("H11").Value = ComboBox11.Value
End Sub
Private Sub ComboBox12_Change()
Sheets("Sayfa1").Range("H12").Value = ComboBox12.Value
End Sub
Private Sub ComboBox13_Change()
Sheets("Sayfa1").Range("H13").Value = ComboBox13.Value
End Sub
Private Sub ComboBox14_Change()
Sheets("Sayfa1").Range("H14").Value = ComboBox14.Value
End Sub
Private Sub ComboBox15_Change()
Sheets("Sayfa1").Range("H15").Value = ComboBox15.Value
End Sub
Private Sub ComboBox16_Change()
Sheets("Sayfa1").Range("H16").Value = ComboBox16.Value
End Sub
Private Sub ComboBox17_Change()
Sheets("Sayfa1").Range("H17").Value = ComboBox17.Value
End Sub
Private Sub ComboBox18_Change()
Sheets("Sayfa1").Range("H18").Value = ComboBox18.Value
End Sub
Private Sub ComboBox2_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h2").Value = ComboBox2.Value
ListBox3.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox2 Then
ListBox3.AddItem
ListBox3.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox3.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox24 = deg
TextBox24 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox3_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h3").Value = ComboBox3.Value
ListBox4.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox3 Then
ListBox4.AddItem
ListBox4.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox4.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox25 = deg
TextBox25 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox4_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h4").Value = ComboBox4.Value
ListBox5.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox4 Then
ListBox5.AddItem
ListBox5.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox5.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox26 = deg
TextBox26 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox5_Change()
Sheets("Sayfa1").Range("H5").Value = ComboBox5.Value
End Sub
Private Sub ComboBox6_Change()
Sheets("Sayfa1").Range("H6").Value = ComboBox6.Value
End Sub
Private Sub ComboBox7_Change()
Sheets("Sayfa1").Range("H7").Value = ComboBox7.Value
End Sub
Private Sub ComboBox8_Change()
Sheets("Sayfa1").Range("H8").Value = ComboBox8.Value
End Sub
Private Sub ComboBox9_Change()
Sheets("Sayfa1").Range("H9").Value = ComboBox9.Value
End Sub
Private Sub CommandButton1_Click()
Unload Me
UserForm4.Show
End Sub
Private Sub ListBox1_Click()
TextBox1 = ListBox1.list(ListBox1.ListIndex, 0)
End Sub
Private Sub TextBox1_Change()
Set S1 = Sheets("sayfa1")
With ListBox1
.ColumnCount = 1
.ColumnWidths = "65;"
End With
ListBox1.Clear
For suz = 2 To WorksheetFunction.CountA([sayfa1!b1:b65536])
alan = UCase(Replace(Replace(Sayfa1.Range("b" & suz), "j", "J"), "k", "K"))
veri = UCase(Replace(Replace(TextBox1, "j", "J"), "k", "K"))
If alan Like "*" & veri & "*" Then
If WorksheetFunction.CountIf(S1.Range("b2:b" & suz), S1.Cells(suz, "b")) > 1 Then GoTo 10
ListBox1.AddItem
ListBox1.list(s, 0) = Sayfa1.Range("B" & suz)
s = s + 1
End If
10 Next
If WorksheetFunction.CountIf([liste!b:b], TextBox1) > 0 Then
sat = [liste!b1:b65536].Find(TextBox1).Row
TextBox21 = Format(Sheets("liste").Cells(sat, "d"), "#,##0")
TextBox6 = Sheets("liste").Cells(sat, "e")
TextBox27 = Sheets("liste").Cells(sat, "c")
End If
'___
toplam = 0
For bak = 2 To Sheets("sayfa1").[b65536].End(3).Row
If Sheets("sayfa1").Cells(bak, "b") = TextBox1 Then toplam = toplam + (Sheets("sayfa1").Cells(bak, "d") * 1)
Next
If TextBox21 = Empty Then GoTo 12
TextBox22 = (TextBox21 * 1) - toplam
TextBox22 = Format(TextBox22, "#,##0")
''_____
12
ComboBox1_Change
ComboBox2_Change
ComboBox3_Change
ComboBox4_Change
For b = 5 To 18
deger = Controls("combobox" & b)
Controls("combobox" & b) = ""
Controls("combobox" & b) = deger
Next
End Sub
Private Sub UserForm_Initialize()
For a = 1 To 14
Set cmb(a).cmb = Controls("combobox" & a + 4)
Next
For i = 1 To Sheets("Sayfa1").Cells(65536, 1).End(xlUp).Row
If WorksheetFunction.CountIf(Sheets("Sayfa1").Range("c2:c" & i), Sheets("Sayfa1").Cells(i, 3)) = 1 Then
For j = 1 To 18
Controls("ComboBox" & j).AddItem Sheets("Sayfa1").Cells(i, 3)
Next
End If
Next i
For a = 2 To 5
Controls("listbox" & a).ColumnCount = 2
Controls("listbox" & a).ColumnWidths = "40;50"
Next
For k = 1 To 18
Controls("ComboBox" & k).Value = Sheets("Sayfa1").Cells(k, "H").Value
Next k
TextBox1 = "."
TextBox1 = ""
End Sub
Dim cmb(14) As New Class1
Private Sub ComboBox1_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h1").Value = ComboBox1.Value
ListBox2.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox1 Then
ListBox2.AddItem
ListBox2.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox2.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox23 = deg
TextBox23 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox10_Change()
Sheets("Sayfa1").Range("H10").Value = ComboBox10.Value
End Sub
Private Sub ComboBox11_Change()
Sheets("Sayfa1").Range("H11").Value = ComboBox11.Value
End Sub
Private Sub ComboBox12_Change()
Sheets("Sayfa1").Range("H12").Value = ComboBox12.Value
End Sub
Private Sub ComboBox13_Change()
Sheets("Sayfa1").Range("H13").Value = ComboBox13.Value
End Sub
Private Sub ComboBox14_Change()
Sheets("Sayfa1").Range("H14").Value = ComboBox14.Value
End Sub
Private Sub ComboBox15_Change()
Sheets("Sayfa1").Range("H15").Value = ComboBox15.Value
End Sub
Private Sub ComboBox16_Change()
Sheets("Sayfa1").Range("H16").Value = ComboBox16.Value
End Sub
Private Sub ComboBox17_Change()
Sheets("Sayfa1").Range("H17").Value = ComboBox17.Value
End Sub
Private Sub ComboBox18_Change()
Sheets("Sayfa1").Range("H18").Value = ComboBox18.Value
End Sub
Private Sub ComboBox2_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h2").Value = ComboBox2.Value
ListBox3.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox2 Then
ListBox3.AddItem
ListBox3.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox3.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox24 = deg
TextBox24 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox3_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h3").Value = ComboBox3.Value
ListBox4.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox3 Then
ListBox4.AddItem
ListBox4.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox4.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox25 = deg
TextBox25 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox4_Change()
Set S1 = Sheets("sayfa1")
S1.Range("h4").Value = ComboBox4.Value
ListBox5.Clear
For a = 2 To S1.[b65536].End(3).Row
If S1.Cells(a, "b") = TextBox1 And S1.Cells(a, "c") = ComboBox4 Then
ListBox5.AddItem
ListBox5.list(c, 0) = S1.Cells(a, "d")
deg = deg + S1.Cells(a, "d")
ListBox5.list(c, 1) = Format(S1.Cells(a, "f"), "dd.mm.yy")
c = c + 1
End If
Next
TextBox26 = deg
TextBox26 = Format(deg, "#,##0")
End Sub
Private Sub ComboBox5_Change()
Sheets("Sayfa1").Range("H5").Value = ComboBox5.Value
End Sub
Private Sub ComboBox6_Change()
Sheets("Sayfa1").Range("H6").Value = ComboBox6.Value
End Sub
Private Sub ComboBox7_Change()
Sheets("Sayfa1").Range("H7").Value = ComboBox7.Value
End Sub
Private Sub ComboBox8_Change()
Sheets("Sayfa1").Range("H8").Value = ComboBox8.Value
End Sub
Private Sub ComboBox9_Change()
Sheets("Sayfa1").Range("H9").Value = ComboBox9.Value
End Sub
Private Sub CommandButton1_Click()
Unload Me
UserForm4.Show
End Sub
Private Sub ListBox1_Click()
TextBox1 = ListBox1.list(ListBox1.ListIndex, 0)
End Sub
Private Sub TextBox1_Change()
Set S1 = Sheets("sayfa1")
With ListBox1
.ColumnCount = 1
.ColumnWidths = "65;"
End With
ListBox1.Clear
For suz = 2 To WorksheetFunction.CountA([sayfa1!b1:b65536])
alan = UCase(Replace(Replace(Sayfa1.Range("b" & suz), "j", "J"), "k", "K"))
veri = UCase(Replace(Replace(TextBox1, "j", "J"), "k", "K"))
If alan Like "*" & veri & "*" Then
If WorksheetFunction.CountIf(S1.Range("b2:b" & suz), S1.Cells(suz, "b")) > 1 Then GoTo 10
ListBox1.AddItem
ListBox1.list(s, 0) = Sayfa1.Range("B" & suz)
s = s + 1
End If
10 Next
If WorksheetFunction.CountIf([liste!b:b], TextBox1) > 0 Then
sat = [liste!b1:b65536].Find(TextBox1).Row
TextBox21 = Format(Sheets("liste").Cells(sat, "d"), "#,##0")
TextBox6 = Sheets("liste").Cells(sat, "e")
TextBox27 = Sheets("liste").Cells(sat, "c")
End If
'___
toplam = 0
For bak = 2 To Sheets("sayfa1").[b65536].End(3).Row
If Sheets("sayfa1").Cells(bak, "b") = TextBox1 Then toplam = toplam + (Sheets("sayfa1").Cells(bak, "d") * 1)
Next
If TextBox21 = Empty Then GoTo 12
TextBox22 = (TextBox21 * 1) - toplam
TextBox22 = Format(TextBox22, "#,##0")
''_____
12
ComboBox1_Change
ComboBox2_Change
ComboBox3_Change
ComboBox4_Change
For b = 5 To 18
deger = Controls("combobox" & b)
Controls("combobox" & b) = ""
Controls("combobox" & b) = deger
Next
End Sub
Private Sub UserForm_Initialize()
For a = 1 To 14
Set cmb(a).cmb = Controls("combobox" & a + 4)
Next
For i = 1 To Sheets("Sayfa1").Cells(65536, 1).End(xlUp).Row
If WorksheetFunction.CountIf(Sheets("Sayfa1").Range("c2:c" & i), Sheets("Sayfa1").Cells(i, 3)) = 1 Then
For j = 1 To 18
Controls("ComboBox" & j).AddItem Sheets("Sayfa1").Cells(i, 3)
Next
End If
Next i
For a = 2 To 5
Controls("listbox" & a).ColumnCount = 2
Controls("listbox" & a).ColumnWidths = "40;50"
Next
For k = 1 To 18
Controls("ComboBox" & k).Value = Sheets("Sayfa1").Cells(k, "H").Value
Next k
TextBox1 = "."
TextBox1 = ""
End Sub