debidebo67
XLDnaute Nouveau
Bonjour,
j'ai réussi à faire ma macro pour une ligne, pour voir si elle fonctionne.
Ensuite j'ai essayé de mettre en place une variable pour qu'elle s'applique à toutes les lignes !
et là ça marche pas :
(Colonne H = 7 ; G =7 ; H = 8; I = 9)
Sub essaimacro()
Dim i As Integer
i = 5
Worksheets("tableau 1").Range("P51000").ClearContents
Application.ScreenUpdating = False
If Cells(7, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(8, i) & " - " & Cells(9, i)
ElseIf Range(8, i) & Cells(9, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i)
ElseIf Cells(8, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i) & " - " & Cells(9, i)
ElseIf Cells(7, i) & Cells(8, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(9, i)
Else
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i) & " - " & Cells(8, i) & " - " & Cells(9, i)
i = i + 1
End If
Application.ScreenUpdating = True
End Sub
pourriez-vous m'aider sur l'erreur SVP ?
Merci d'avance
j'ai réussi à faire ma macro pour une ligne, pour voir si elle fonctionne.
Ensuite j'ai essayé de mettre en place une variable pour qu'elle s'applique à toutes les lignes !
et là ça marche pas :
(Colonne H = 7 ; G =7 ; H = 8; I = 9)
Sub essaimacro()
Dim i As Integer
i = 5
Worksheets("tableau 1").Range("P51000").ClearContents
Application.ScreenUpdating = False
If Cells(7, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(8, i) & " - " & Cells(9, i)
ElseIf Range(8, i) & Cells(9, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i)
ElseIf Cells(8, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i) & " - " & Cells(9, i)
ElseIf Cells(7, i) & Cells(8, i) = "" Then
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(9, i)
Else
Cells(i, 16).Value = Cells(6, i) & " - " & Cells(7, i) & " - " & Cells(8, i) & " - " & Cells(9, i)
i = i + 1
End If
Application.ScreenUpdating = True
End Sub
pourriez-vous m'aider sur l'erreur SVP ?
Merci d'avance