IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

arrondi non désiré excel/Vba


Sujet :

Macros et VBA Excel

  1. #1
    Membre à l'essai
    Homme Profil pro
    Chargé d'affaire
    Inscrit en
    Juillet 2018
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Chargé d'affaire

    Informations forums :
    Inscription : Juillet 2018
    Messages : 40
    Points : 14
    Points
    14
    Par défaut arrondi non désiré excel/Vba
    Bonjour,

    Je ne comprend pas pourquoi excel ne me prend que les nombres ronds. Pouvez vous m'aider s'il vous plait ?

    MErci d'avance

    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
     
    Sub viaHaut()
     
    Dim ZA As Double
    Dim ZB As Double
    Dim ZC As Double
     
    j = Cells(Columns(1).Cells.Count, 1).End(xlUp).Row
     
    For a = j To 1 Step -1
     
    If a <> 1 Then
     
    If (Cells(a, 1) <> Cells(a + 1, 1)) Then
     
     
     
     
        FUT = Left(Cells(a, 1), 2)
     
     
        If FUT = "VG" Then
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
        ElseIf FUT = "Z " Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
        ElseIf FUT = "GX" Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
     
        ElseIf FUT = "EO" Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
        ElseIf FUT = "CF" Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
        ElseIf FUT = "CM" Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
        ElseIf FUT = "SM" Then
     
     
        X = Right(Cells(a, 1), 2)
        Y = Right(Cells(a + 1, 1), 2)
     
     
     
        End If
     
        If (Cells(a, 5) <> Cells(a + 1, 5)) Then
     
     
     
            If ((Cells(a, 5) = Cells(a + 1, 5) + Cells(a + 2, 5)) And (Cells(a + 1, 1) = Cells(a + 2, 1))) Then
     
            ZA = Cells(a + 1, 5) * Cells(a + 1, 4) + Cells(a + 2, 5) * Cells(a + 1, 4)
     
            ZB = Cells(a + 1, 5) + Cells(a + 2, 5)
     
            ZC = Round(ZA / ZB, 4)
            Cells(a, 9) = ZC
     
            Cells(a, 8) = Cells(a, 5)
     
            If X < Y Then
            Cells(a, 10) = Cells(a, 4) - Cells(a, 9)
     
            ElseIf X > Y Then
            Cells(a, 10) = Cells(a, 9) - Cells(a, 4)
     
            End If
     
            End If
     
     
        End If
     
    End If
     
    End If
     
     
     
     
    Next
     
     
     
    End Sub
    Fichiers attachés Fichiers attachés

  2. #2
    Inactif  

    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2012
    Messages
    4 903
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 68
    Localisation : Canada

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2012
    Messages : 4 903
    Points : 10 166
    Points
    10 166
    Billets dans le blog
    36

  3. #3
    Membre à l'essai
    Homme Profil pro
    Chargé d'affaire
    Inscrit en
    Juillet 2018
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Chargé d'affaire

    Informations forums :
    Inscription : Juillet 2018
    Messages : 40
    Points : 14
    Points
    14
    Par défaut
    Bonsoir,


    Comme je ne vois pas ou est mon erreur apres voir beaucoup cherché (soit paramètre excel ou dans mon code). je demande de l'aide rien de plus....

    merci

Discussions similaires

  1. Excel VBA PB de variable non définie (=vide)
    Par elhelios dans le forum Excel
    Réponses: 1
    Dernier message: 27/02/2012, 10h48
  2. Fonction non valide ( exécution fonction excel vba)
    Par Sawzaaren dans le forum Macros et VBA Excel
    Réponses: 7
    Dernier message: 14/02/2012, 14h34
  3. Formule excel non reconnue en VBA
    Par geopolux dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 10/10/2008, 18h05
  4. Problème Code VBA, ajout non désiré sur bouton
    Par vivicente dans le forum VBA Access
    Réponses: 3
    Dernier message: 12/06/2008, 17h33
  5. [EXCEL][VBA] Compter les cellules non-vides
    Par Squelet dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 27/02/2006, 15h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo