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 :

Simplifier mon code


Sujet :

Macros et VBA Excel

Mode arborescent

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Décembre 2011
    Messages
    343
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2011
    Messages : 343
    Par défaut Simplifier mon code
    Bonsoir,

    Je recherche a simplifier mon code.

    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
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    For n = 3 To 50
     
    'Point normal
    If Cells(n, 4) < 162 And Cells(n, 4) > 0 Then
        If Cells(n, 4) <> 81 And Cells(n, 4) <> 91 And Cells(n, 4) <> 71 Then
                If Cells(n, 5) = 1 Then
                    If 162 - Cells(n, 4) = Cells(n, 8) Then
                    Cells(n, 8) = 162 - Cells(n, 4)
                    Cells(n, 4) = Cells(n, 4) + 20
                    End If
                Else
                Cells(n, 8) = 162 - Cells(n, 4)
                End If
        End If
    End If
    If Cells(n, 8) < 162 And Cells(n, 8) > 0 Then
        If Cells(n, 8) <> 81 And Cells(n, 8) <> 91 And Cells(n, 8) <> 71 Then
                If Cells(n, 9) = 1 Then
                    If 162 - Cells(n, 8) = Cells(n, 4) Then
                    Cells(n, 4) = 162 - Cells(n, 8)
                    Cells(n, 8) = Cells(n, 8) + 20
                    End If
                ElseIf Cells(n, 9) = 0 And Cells(n, 5) = 0 Then
                Cells(n, 4) = 162 - Cells(n, 8)
                End If
        End If
    End If
     
    If [H4] = 81 And [L1] <> 1 Then
    [H4] = 0
    [D4] = 81
    [A1] = 81
    [L1] = 1
    ElseIf [D4] = 81 And [L1] <> 1 Then
    [D4] = 0
    [H4] = 81
    [A1] = 81
    [L1] = 1
    End If
    If [A1] = 81 And [D5] <> 0 And [H5] <> 0 Then
       If [D5] < [H5] Then
       [H5] = [H5] + [A1]
       [A1] = 0
       ElseIf [D5] > [H5] Then
      [D5] = [D5] + [A1]
       [A1] = 0
        End If
    End If
    If [H5] = 81 And [L2] <> 1 Then
    [H5] = 0
    [D5] = 81
    [A1] = 81
    [L2] = 1
    ElseIf [D5] = 81 And [L2] <> 1 Then
    [D5] = 0
    [H5] = 81
    [A1] = 81
    [L2] = 1
    End If
    If [A1] = 81 And [D6] <> 0 And [H6] <> 0 Then
       If [D6] < [H6] Then
       [H6] = [H6] + [A1]
       [A1] = 0
       ElseIf [D6] > [H6] Then
      [D6] = [D6] + [A1]
       [A1] = 0
        End If
    End If
     
    Next
    End Sub
    Un fichier valant mieux qu'un long discours, veuillez voir la pièce jointe.
    D'avance merci à qui pourra m'aider.
    Cordialement
    Max
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. [XL-2007] Comment simplifier mon code VBA SVP?
    Par anthooooony dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 20/02/2012, 10h59
  2. [XL-2007] Simplifier mon code ?
    Par hdisnice dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 30/06/2011, 08h44
  3. Comment pourrais-je simplifier mon code
    Par pierrot10 dans le forum jQuery
    Réponses: 1
    Dernier message: 28/08/2010, 09h30
  4. Simplifier mon code
    Par pierre987321 dans le forum Langage
    Réponses: 5
    Dernier message: 07/04/2010, 12h49
  5. Simplifier mon code "Majuscule/Minuscule"
    Par Manou34 dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 24/01/2008, 17h05

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