Erreur 6' dépassement de capacité

Bonjour,

Me voilà confronté à un problème auquel je ne trouve aucune solution, pire encore, ce problème n'intervient que sur une petite partie de mon code pourtant très similaire au reste du code...

Voici un bout du code :

Sub AjusterDonnées()
Dim Doc1, Doc2, iC%, i%

    Set Doc1 = Workbooks("Fichier excel restitution NEW DEAL.xls").Sheets("Feuil1")
    Set Doc2 = Workbooks("Fichier excel restitution NEW DEAL.xls").Sheets("Feuil2")
    Set Doc3 = Workbooks("Fichier excel restitution NEW DEAL.xls").Sheets("Feuil3")

    For iC = 7 To 23

        'Calcul pourcentages
        If Doc1.Cells(29, iC).Value <> "" Then
        Doc3.Cells(29, iC).Value = Doc1.Cells(29, iC).Value / Doc1.Cells(5, iC).Value
        End If
        If Doc1.Cells(45, iC).Value <> "" Then
        Doc3.Cells(45, iC).Value = Doc1.Cells(45, iC).Value / Doc1.Cells(5, iC).Value
        End If
        If Doc1.Cells(49, iC).Value <> "" Then
        Doc3.Cells(49, iC).Value = Doc1.Cells(49, iC).Value / Doc1.Cells(45, iC).Value
        End If
        If Doc1.Cells(53, iC).Value <> "" Then
        Doc3.Cells(53, iC).Value = Doc1.Cells(53, iC).Value / Doc1.Cells(45, iC).Value
        End If
        If Doc1.Cells(57, iC).Value <> "" Then
        Doc3.Cells(57, iC).Value = Doc1.Cells(57, iC).Value / Doc1.Cells(45, iC).Value
        End If
        If Doc1.Cells(55, iC).Value <> "" Then
        Doc3.Cells(55, iC).Value = Doc1.Cells(55, iC).Value / Doc1.Cells(45, iC).Value
        End If
        If Doc1.Cells(59, iC).Value <> "" Then
        Doc3.Cells(59, iC).Value = Doc1.Cells(59, iC).Value / Doc1.Cells(45, iC).Value
        End If

        If Doc1.Cells(33, iC).Value <> "" Then
        Doc3.Cells(33, iC).Value = Doc1.Cells(33, iC).Value / Doc1.Cells(29, iC).Value
        End If
        If Doc1.Cells(37, iC).Value <> "" Then
        Doc3.Cells(37, iC).Value = Doc1.Cells(37, iC).Value / Doc1.Cells(29, iC).Value
        End If
        If Doc1.Cells(41, iC).Value <> "" Then
        Doc3.Cells(41, iC).Value = Doc1.Cells(41, iC).Value / Doc1.Cells(29, iC).Value
        End If
        If Doc1.Cells(39, iC).Value <> "" Then
        Doc3.Cells(39, iC).Value = Doc1.Cells(39, iC).Value / Doc1.Cells(29, iC).Value
        End If
        If Doc1.Cells(43, iC).Value <> "" Then
        Doc3.Cells(43, iC).Value = Doc1.Cells(43, iC).Value / Doc1.Cells(29, iC).Value
        End If
Next

End Sub

Ici le problème intervient sur les cellules 33, 37, 39 et 41

J'ai tout essayé, arrondir les résultats, changer le type des variables rien n'y fait.

De temps en temps la cellule 29 est égale à zéro, j'ai donc essayé de rajouter un And Doc1.Cells(23, iC) <> "0" dans les fonction if référentes aux cellules concernées mais cela ne change rien...

Je me prend la tête la dessus depuis au moins deux jours, une aide serait la bienvenue!

Le probléme venait des "" que je mettais autour du 0 dans ma fonction If, or cela est réservé pour du texte...

Merci quand même, bon weekend

Rechercher des sujets similaires à "erreur depassement capacite"