• DİKKAT

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

döngü problemi

Katılım
9 Temmuz 2008
Mesajlar
277
Excel Vers. ve Dili
2007
a = 31
For i = 7 To 26
If Cells(i, 4).Value < 0 Then
Cells(a, 4).Value = Cells(i, 4)
Cells(a, 2).Value = Cells(i, 2)
Cells(a, 4).Font.Color = vbWhite
Cells(a, 4).Interior.Color = vbBlack
Cells(a, 2).Font.Color = vbWhite
Cells(a, 2).Interior.Color = vbBlack

If Cells(i, 12).Value < 0 Then
Cells(a, 12).Value = Cells(i, 12)
Cells(a, 10).Value = Cells(i, 10)
Cells(a, 12).Font.Color = vbWhite
Cells(a, 12).Interior.Color = vbBlack
Cells(a, 10).Font.Color = vbWhite
Cells(a, 10).Interior.Color = vbBlack

If Cells(i, 20).Value < 0 Then
Cells(a, 20).Value = Cells(i, 20)
Cells(a, 18).Value = Cells(i, 18)
Cells(a, 20).Font.Color = vbWhite
Cells(a, 20).Interior.Color = vbBlack
Cells(a, 18).Font.Color = vbWhite
Cells(a, 18).Interior.Color = vbBlack
a = a + 1

End If
End If
End If
Next i

Yukarıdaki kodda a=a+1 yazmama rağmen a değişkeni fazla 32 ye çıkıyor. Problemi çözemedim . Yardımlarınız için.
 
Merhaba


Ne kadar artacağını yazmamışsınız ben i değişkenine göre yazdım.

Kod:
b = 31
For i = 7 To 26

a=b+(i-7)

If Cells(i, 4).Value < 0 Then
Cells(a, 4).Value = Cells(i, 4)
Cells(a, 2).Value = Cells(i, 2)
Cells(a, 4).Font.Color = vbWhite
Cells(a, 4).Interior.Color = vbBlack
Cells(a, 2).Font.Color = vbWhite
Cells(a, 2).Interior.Color = vbBlack

If Cells(i, 12).Value < 0 Then
Cells(a, 12).Value = Cells(i, 12)
Cells(a, 10).Value = Cells(i, 10)
Cells(a, 12).Font.Color = vbWhite
Cells(a, 12).Interior.Color = vbBlack
Cells(a, 10).Font.Color = vbWhite
Cells(a, 10).Interior.Color = vbBlack

If Cells(i, 20).Value < 0 Then
Cells(a, 20).Value = Cells(i, 20)
Cells(a, 18).Value = Cells(i, 18)
Cells(a, 20).Font.Color = vbWhite
Cells(a, 20).Interior.Color = vbBlack
Cells(a, 18).Font.Color = vbWhite
Cells(a, 18).Interior.Color = vbBlack

End If
End If
End If
Next i
 
Merhaba

Siz a değişkeninin ne gibi bir değer alacağını yazmamışsız bende i değişkenine göre yazdım.

a değişkeninin artışının nasıl olacağını açıklayabilirmisiniz.
 
Geri
Üst