• DİKKAT

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

Çözüldü yuvarlama sorunu

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,543
Excel Vers. ve Dili
2021 LTSC TR
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Not Intersect(Target, Range("C7:C167")) Is Nothing Then
        sat = Target.Row
        Cells(sat, "D") = Round(Cells(sat, "C") * Range("D6"), 2)
        Cells(sat, "E") = Round(Cells(sat, "C") * Range("E6"), 2)
        Cells(sat, "F") = Round(Cells(sat, "C") * Range("F6"), 2)
        Cells(sat, "G") = Round(Cells(sat, "D") + Cells(sat, "E") + Cells(sat, "F"), 2)
       Cells(sat, "H") = Round(Cells(sat, "C") * Range("H6"), 2)
        Cells(sat, "I") = Round(Cells(sat, "C") * Range("I6"), 2)
        Cells(sat, "J") = Round(Cells(sat, "H") + Cells(sat, "I"), 2)
        Cells(sat, "K") = Round(Cells(sat, "G") + Cells(sat, "J"), 2)
        Cells(sat, "X") = Round(Cells(sat, "C") + Cells(sat, "O"), 2)
        
    Else
        If Not Intersect(Target, Range("L7:L167, M7:M167, N7:N167")) Is Nothing Then
            sat = Target.Row
        Cells(sat, "O") = Round(Cells(sat, "L") + Cells(sat, "M") + Cells(sat, "N"), 2)
        Cells(sat, "P") = Round(Cells(sat, "O") * Range("P6"), 2)
        Cells(sat, "Q") = Round(Cells(sat, "O") * Range("Q6"), 2)
        Cells(sat, "R") = Round(Cells(sat, "O") * Range("R6"), 2)
        Cells(sat, "S") = Round(Cells(sat, "P") + Cells(sat, "Q") + Cells(sat, "R"), 2)
        Cells(sat, "T") = Round(Cells(sat, "O") * Range("T6"), 2)
        Cells(sat, "U") = Round(Cells(sat, "O") * Range("U6"), 2)
        Cells(sat, "V") = Round(Cells(sat, "T") + Cells(sat, "U"), 2)
        Cells(sat, "W") = Round(Cells(sat, "S") + Cells(sat, "V"), 2)
        Cells(sat, "X") = Round(Cells(sat, "C") + Cells(sat, "O"), 2)
        Range("C1") = Round(WorksheetFunction.Sum(Range("X7:X167")), 2)
        
            
    Else
      
    End If
   End If
End Sub



Yukarıda yer alan kodda yuvarlama konusunda sıkıntı yaşıyorum.
Yardımcı olabilir misiniz?
 
Sıkıntı sizde değil Round da. VBA round sonuçları hatalı veriyor.
Formüller de aşağıdaki değişiklikleri yaparsanız sonuçlar düzelecektir

Cells(sat, "X") = Round(CDec(Cells(sat, "C") + Cells(sat, "O")), 2)

yada

Cells(sat, "X") = Application.WorksheetFunction.Round(Cells(sat, "C") + Cells(sat, "O"), 2)
 
Teşekkür eder, saygılarımı sunarım.
 
Geri
Üst