• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

ComboBox Döngü içinde kullanımı

  • Konbuyu başlatan Konbuyu başlatan myway
  • Başlangıç tarihi Başlangıç tarihi
Katılım
24 Ağustos 2004
Mesajlar
29
Anasayfa, Ocak, Şubat, Mart, ..... Aralık adında 13 adet sayfam var. Anasayfa'da, Ocak, Şubat, Mart, ..... Aralık tan oluşan bir ComboBox' ım var.

For i= 1 to 12
ComboBox1.............
Next i

Gibi bir döngü ile bu sayfalarda bazı değerleri alıp aritmetik işlemler yapmak istiyorum.
Bu döngü nasıl olmalı ?
 
Merhaba
Bir örnek dosya ekleyiniz. Yardımcı olalım...
 
Merhaba,

ekte bir dosya hazırladım. Lakin bu dosyada userform üzerine bir listbox ekleyerek
çözüm oluşturdum. Userform üzerinde "Veri Al" butonu ile tüm sayfalardaki toplanacak veriler listboxda listelenir ve "Genel Toplam al" butonu ile de textboxa toplam işleminin sonucu yazdırılır.

Kod:
Private Sub UserForm_Initialize()
ListBox1.ColumnCount = 4
End Sub
Private Sub CommandButton1_Click()
ListBox1.ColumnCount = 3
Dim i As Integer
Dim say As Integer
Dim aylar As String
Dim deger1 As String
Dim deger2 As String
Dim deger3 As String
ListBox1.Clear
say = ComboBox1.ListCount
For i = 1 To say
ComboBox1.Value = ComboBox1.List(i - 1)
aylar = ComboBox1.Value
deger1 = Sheets(aylar).Cells(1, "A").Value
deger2 = Sheets(aylar).Cells(2, "A").Value
deger3 = Sheets(aylar).Cells(3, "A").Value
'***************************************************************************************
 Dim lngIndex As Long
    With ListBox1
        .ColumnCount = 4
        'For lngIndex = 0 To 5
            .AddItem aylar
            .List(.ListCount - 1, 1) = deger1
            .List(.ListCount - 1, 2) = deger2
            .List(.ListCount - 1, 3) = deger3
        'Next
    End With
   
'***************************************************************************************
'ListBox1.AddItem ComboBox1.Value & " " & deger1 & " " & deger2 & " " & deger3
If i >= 12 Then Exit For
Next i

End Sub
Private Sub CommandButton2_Click()
Dim toplam1 As Double
Dim toplam2 As Double
Dim toplam3 As Double
For i = 0 To ListBox1.ListCount - 1
    toplam1 = ListBox1.Column(1, i) + toplam1
    toplam2 = ListBox1.Column(2, i) + toplam2
    toplam3 = ListBox1.Column(3, i) + toplam3
Next
TextBox1.Text = toplam1 + toplam2 + toplam3
'TextBox1.Text = Format(toplam, "#,##0.00")
End Sub
 

Ekli dosyalar

Geri
Üst