Bonjour à vous

je compose un code pour arrondir en Floor et en Ceiling et je butte sur une partie importante de la function.

Pour expliquer les caractéristiques recherchées de la function, j'aimerais par exemple arrondir au 10em ou au 100em en fonction de la profondeur.

Donc

Supposons 295
prof=1 au 100em
prof= 2 au 10em

supposons 2150
prof=1 au 1000em
prof= 2 au 100em
prof=3 au 10em

etc

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
'IntLength est la longueur du nombre à arrondir ex. 255
ElseIf IntLength = 3 Then
 
                    Strtmp = Strtmp.Insert(Prof, ",")
 
                    If Prof = 1 Then
                        Coef = 100
'Donc ici 255 retourne 300
                    ElseIf Prof = 2 Then
                        Coef = 10
'Donc ici 255 retourne 260
 
                    End If
 
IntTmp = Math.Ceiling(CDbl(Strtmp))
                    IntTmp = IntTmp * Coef


je travail à améliorer la function pour qu'elle reconnaisse dans quel fraction arrondir en fonction de la profondeur choisi

quelqu'un a une idée ?
merci