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 :

Probléme de compatibilté macro vba excel 2007 vers 2002


Sujet :

Macros et VBA Excel

  1. #1
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    36
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 36
    Points : 28
    Points
    28
    Par défaut Probléme de compatibilté macro vba excel 2007 vers 2002
    Bonjour tous le monde,

    Comme indiqué dans le sujet, j'ai un petit probléme de compatibilité des macros avec un fichier .xlsx vers xls aprés l'avoir converti en version antérieur.

    Quelqu'un aurait-il une solution à m'approrter ?

    Salutations

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonjour

    Sans la macro, cela va être dur de te répondre.

    Tu dois utiliser une fonction avec des paramètres qui n'existent pas dans la version 2002.

    Il faut trouver la partie qui bug et regarder dans l'aide d'Excel 2002.

    Starec

  3. #3
    Nouveau membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    36
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 36
    Points : 28
    Points
    28
    Par défaut
    Voici le code que j'ai dans une feuille sous excel 2007

    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
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    Private Sub Worksheet_Change(ByVal Target As Range)
     
    Dim r As Range
    Dim c As Range
     
        On Error GoTo errSelection
     
            If Target.Validation.Type <> 0 Then
                Set r = Range(Mid(Target.Validation.Formula1, 2))
                For Each c In r.Cells
                    If c = Target Then
                        Range("D" & c.Row).Copy Range("D" & Target.Row)
                        Range("E" & c.Row).Copy Range("E" & Target.Row)
                        Range("G" & c.Row).Copy Range("G" & Target.Row)
                        Range("H" & c.Row).Copy Range("H" & Target.Row)
                        Range("J" & c.Row).Copy Range("J" & Target.Row)
                        Exit For
                    End If
                Next c
            End If
     
            GoTo ext
     
    errSelection:
            Select Case Err.Number
                Case 1004
                    Err.Clear
                Case Else
                    MsgBox "erreur non prévue" & vbCrLf & "Erreur n°" & Err.Number & vbCrLf & _
                            Err.Description, vbCritical + vbOKOnly, "erreur"
                    Err.Clear
            End Select
     
    ext:
     
    End Sub
     
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     
    Dim nligne As Integer
    Dim Feuille As Worksheet
    Dim CelluleRéférence As Range, CelluleIndex As Range, Cellulepointeur As Range
     
        Set Feuille = Worksheets("FeuilleDeTravail")
        Set CelluleRéférence = Feuille.Range("B4")
        Set CelluleIndex = Feuille.Range("B5")
        Set Cellulepointeur = Feuille.Range("B6")
     
            nligne = CelluleRéférence.Value + CelluleIndex
     
    'CREATION LIGNE
     
            If Target.Row = nligne And Target.Column <= 4 Then
     
            On Error GoTo errSelection
     
                Bordure Range("A" & nligne + 1 & ":J" & nligne + 1)
                CelluleIndex = CelluleIndex + 1
                    caseselect nligne + 1, 12
                    Cellulepointeur = Cellulepointeur + 1
                lienext nligne
                detailclient nligne
                Target.Select
            End If
     
            GoTo exitfin
     
    errSelection:
            Select Case Err.Number
                Case 1004
                    Err.Clear
                Case Else
                    MsgBox "erreur non prévue" & vbCrLf & "Erreur n°" & Err.Number & vbCrLf & _
                    Err.Description, vbCritical + vbOKOnly, "erreur"
                    Err.Clear
                End Select
     
    exitfin:
     
    End Sub
     
    Sub Bordure(plage As Range)
     
        plage.Select
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
     
        Range("F" & plage.Row).Formula = "=C" & plage.Row & "*E" & plage.Row
        Range("I" & plage.Row).Formula = "=C" & plage.Row & "*H" & plage.Row
     
    End Sub
     
    Sub caseselect(nl As Integer, nldebut As Integer)
     
    Range("B" & nl).Validation.Add Type:=xlValidateList, Formula1:="= B" & nldebut & ":B" & nl
    Range("G" & nl).Validation.Add Type:=xlValidateList, Formula1:="='Indice Taux'!B5:B14"
    Range("J" & nl).Validation.Add Type:=xlValidateList, Formula1:="='Indice Taux'!F5:F14"
     
    End Sub
     
    Sub lienext(i As Integer)
     
    Dim c As Worksheet
     
        Set c = Worksheets("Feuilledetravail")
     
            c.Range("A" & i).FormulaR1C1 = "=Devis!R" & i & "C1"
            c.Range("B" & i).FormulaR1C1 = "=Devis!R" & i & "C2"
            c.Range("C" & i).FormulaR1C1 = "=Devis!R" & i & "C3"
            c.Range("D" & i).FormulaR1C1 = "=Devis!R" & i & "C4"
            c.Range("E" & i).FormulaR1C1 = "=Devis!R" & i & "C5"
            c.Range("F" & i).FormulaR1C1 = "=Devis!R" & i & "C6"
            c.Range("G" & i).FormulaR1C1 = "=Devis!R" & i & "C7"
            c.Range("H" & i).FormulaR1C1 = "=Devis!R" & i & "C8"
            c.Range("I" & i).FormulaR1C1 = "=Devis!R" & i & "C9"
            c.Range("J" & i).FormulaR1C1 = "=Devis!R" & i & "C10"
     
            c.Range("K" & i).FormulaR1C1 = "=IF(RC[-10]<>0,1,0)"
     
            c.Range("L" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B5,F" & i & "*(1+ 'Indice Taux'!D5),)"
            c.Range("M" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B6,F" & i & "*(1+ 'Indice Taux'!D6),)"
            c.Range("N" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B7,F" & i & "*(1+ 'Indice Taux'!D7),)"
            c.Range("O" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B8,F" & i & "*(1+ 'Indice Taux'!D8),)"
            c.Range("P" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B9,F" & i & "*(1+ 'Indice Taux'!D9),)"
            c.Range("Q" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B10,F" & i & "*(1+ 'Indice Taux'!D10),)"
            c.Range("R" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B11,F" & i & "*(1+ 'Indice Taux'!D11),)"
            c.Range("S" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B12,F" & i & "*(1+ 'Indice Taux'!D12),)"
            c.Range("T" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B13,F" & i & "*(1+ 'Indice Taux'!D13),)"
            c.Range("U" & i).Formula = _
                "=IF(G" & i & "='Indice Taux'! B14,F" & i & "*(1+ 'Indice Taux'!D14),)"
     
            c.Range("V" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F5,I" & i & "*('Indice Taux'!H5),)"
            c.Range("W" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F6,I" & i & "*('Indice Taux'!H6),)"
            c.Range("X" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F7,I" & i & "*('Indice Taux'!H7),)"
            c.Range("Y" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F8,I" & i & "*('Indice Taux'!H8),)"
            c.Range("Z" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F9,I" & i & "*('Indice Taux'!H9),)"
            c.Range("AA" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F10,I" & i & "*('Indice Taux'!H10),)"
            c.Range("AB" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F11,I" & i & "*('Indice Taux'!H11),)"
            c.Range("AC" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F12,I" & i & "*('Indice Taux'!H12),)"
            c.Range("AD" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F13,I" & i & "*('Indice Taux'!H13),)"
            c.Range("AE" & i).Formula = _
                "=IF(J" & i & "='Indice Taux'! F14,I" & i & "*('Indice Taux'!H14),)"
            c.Range("AF" & i).Formula = _
                "=SUM(L" & i & ":AE" & i & ")"
     
    End Sub
     
    Sub detailclient(i As Integer)
     
    Dim a As Worksheet, b As Worksheet
     
        Set a = Worksheets("Détail Client")
        Set b = Worksheets("FeuilleDetravail")
     
            a.Range("A" & i - 9).Formula = _
                "=if('FeuilleDetravail'! A" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! A" & i & ")"
            a.Range("B" & i - 9).Formula = _
                "=if('FeuilleDetravail'! B" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! B" & i & ")"
            a.Range("C" & i - 9).Formula = _
                "=if('FeuilleDetravail'! C" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! C" & i & ")"
            a.Range("D" & i - 9).Formula = _
                "=if('FeuilleDetravail'! D" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! D" & i & ")"
            a.Range("E" & i - 9).Formula = _
                "=F" & i - 9 & "/C" & i - 9 & ""
     
        If b.Range("B3") = 1 Then
            a.Range("F" & i - 9).Formula = _
                "=if('FeuilleDetravail'! AF" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! AF" & i & "* (1 + SommeMOBureau/SommeVenteBrute)*(1+coeffinal)*(1/(1+remise)))"
        Else
            a.Range("F" & i - 9).Formula = _
                "=if('FeuilleDetravail'! AF" & i & "=0," & Chr(34) & Chr(34) & ",'FeuilleDetravail'! AF" & i & "*(1+coeffinal)*(1/(1+remise)))"
        End If
     
        If i > 13 Then
            a.Range("G" & i - 10).Formula = _
                "=if('FeuilleDetravail'! K" & i & "=0," & Chr(34) & Chr(34) & ",SUM(F3:F" & i - 10 & ")- SUM(G3:G" & i - 11 & "))"
        End If
     
    End Sub
    Le probléme viens en partie de MID et de lapartie de création de cadre de ligne

Discussions similaires

  1. [XL-2007] erreur macro vba excel 2007
    Par yan14 dans le forum Macros et VBA Excel
    Réponses: 7
    Dernier message: 22/02/2012, 23h04
  2. convertisseur de macro vba excel 2003 vers excel 2010
    Par mauguin dans le forum Macros et VBA Excel
    Réponses: 4
    Dernier message: 29/10/2011, 18h13
  3. vb6 ou vba - lenteur execution macro sur excel 2007
    Par Enigme dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 26/03/2010, 13h50
  4. Macro VBA EXCEL 2003 vers 2007
    Par Jacques13170 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 30/04/2008, 19h23
  5. VBA Excel 2007 - Insertion d'images avec Enregistreur de Macros
    Par PhilC dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 26/10/2007, 02h05

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