For i=12 to 35 mais pas 30 ?

  • Initiateur de la discussion Initiateur de la discussion benoua
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

benoua

XLDnaute Occasionnel
Bonjour à tous

Code:
For agregat = 17 To 35
     If (line.Columns(agregat) <> 0) Then
    
       target.Cells(indexRow, "A").Value = CodeUR
       target.Cells(indexRow, "B").Value = affaire
       target.Cells(indexRow, "C").Value = localisation
       target.Cells(indexRow, "D").Value = intitule
             
       If (source.Cells(4, agregat) = "Salaires CDI") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Salaires CDD") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
        ElseIf (source.Cells(4, agregat) = "Salaires Autres") Then
         target.Cells(indexRow, "E").Value = "1"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Frais d'Expatriation") Then
         target.Cells(indexRow, "E").Value = "2"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Missions") Then
         target.Cells(indexRow, "E").Value = "3"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Fonctionnement") Then
         target.Cells(indexRow, "E").Value = "6"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Co-Traitance") Then
         target.Cells(indexRow, "E").Value = "7"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Autres Charges") Then
         target.Cells(indexRow, "E").Value = "9"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Equipement Propriété Client") Then
         target.Cells(indexRow, "E").Value = "4"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Equipement Propriété Cirad") Then
         target.Cells(indexRow, "E").Value = "5"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Sous-Traitance Interne (inter)") Then
         target.Cells(indexRow, "E").Value = "8"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Sous-Traitance Interne (intra)") Then
         target.Cells(indexRow, "E").Value = "16"
         coefficient = -1
       ElseIf (source.Cells(4, agregat) = "Produits Externes") Then
         target.Cells(indexRow, "E").Value = "10"
         coefficient = 1
       ElseIf (source.Cells(4, agregat) = "Produits Internes (inter)") Then
         target.Cells(indexRow, "E").Value = "11"
         coefficient = 1
        ElseIf (source.Cells(4, agregat) = "Produits Internes (intra)") Then
         target.Cells(indexRow, "E").Value = "17"
         coefficient = 1
         ElseIf (source.Cells(4, agregat) = "Autres Produits") Then
         target.Cells(indexRow, "E").Value = "14"
         coefficient = 1
       Else
         target.Cells(indexRow, "E").Value = source.Cells(1, agregat)
         coefficient = 1
       End If
      
      
       target.Cells(indexRow, "F") = line.Columns(agregat).Value / 1000 * coefficient
       
       indexRow = indexRow + 1

Dans le code suivant j'aimerai qu'il ne prenne pas la colonne 30 en compte, est ce que vous pouvez m'aider plz, je ne trouve pas le code qu'il faut mettre... :/
 
Re : For i=12 to 35 mais pas 30 ?

Impeccable ca fonctionne! C'est tout bête mais je n'y avais pas pensé! 😱
merci beaucoup

edit : ta solution fonctionne aussi Chti160! Merci
et je me rends compte que je dois rentrer chez moi.. j'susi vraiment fatigué pour ne pas avoir pensé à mettre ça au lieu de me prendre la tête sur le For :-/
 
Dernière édition:
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Retour