2 chiffre après la virgule

Bonsoir,

S'il vous plait j'ai besoin de votre aide, j'ai un algorithme qui calcule une colonne mais il m'affiche le résulté sous forme :

" 26,85050798

24,38316401

24,38316401

24,38316401

Par contre je voulais juste 2 chiffre après la virgule, voila le code que j'ai utilisé:

Sub calculScrap1()

Dim ws As Worksheet
Const SourceColumn As String = "AH"
Const DestColumn As String = "AK"
Const TotalCell As String = "AJ6"  'total defect of all defects
Const StartRow As Long = 9
Dim EndRow As Long, i As Long
Dim VisRng  As Range, c As Range
On Error Resume Next
Set ws = Sheet4
With ws
    EndRow = .Range("AH" & StartRow).End(xlDown).Row '<-- get last row with data in Column G

    ' set visible range to only filtered cells in Column G
    Set VisRng = .Range(Range(SourceColumn & StartRow), Range(SourceColumn & EndRow)).SpecialCells(xlCellTypeVisible)

    .Range(TotalCell).Formula = WorksheetFunction.sum(VisRng) '<-- re-calculate Total defects according to visible range

    For Each c In VisRng
        .Range(DestColumn & c.Row).Formula = "=(" & SourceColumn & c.Row & "/" & TotalCell & ")*100"
    Next c
End With
On Error GoTo 0

End Sub

Bonsoir,

ajoute l'instruction

.columns(destcolumn).numberformat="0.00"

avant le end with

merci beaucoup

Rechercher des sujets similaires à "chiffre virgule"