Re : problème sur une boucle for
coucou toujours le même code j'ai une erreur sur la passage en route, erreur 1004
Private Sub CommandButton1_Click()
Sheets("tableau maître").Unprotect
Dim Ws As Worksheet
For Each Ws In ThisWorkbook.Worksheets
With Ws
a = TextBox1
b = .Cells(12, 13)
i = 12
j = 13
Do While .Cells(i, j) <> ""
j = j + 4
Loop
.Cells(i, j) = a
.Range(.Cells(i, j), .Cells(i, j + 3)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
.Range("m13", "p48").Copy Destination:=.Cells(13, j)
.Range(.Cells(14, j), .Cells(44, j + 3)).ClearContents
End With
Next Ws
TextBox1.Value = ""
UserForm1.Hide
Sheets("tableau maître").Protect
End Sub