Salut Dimitri, sabV,
à moitié à l'aveuglette...
Private Sub cmdGO_Click()
'
Dim rCells As Range, rCel As Range
iRow = Range("A" & Rows.Count).End(xlUp).Row
'
With Worksheets("PLAN RACK")
Set rCells = Union(.Range("B1:AN10"), .Range("B13:AN22"), .Range("B27:AN36"), .Range("B39:AN48"))
rCells.ClearContents
For x = 2 To iRow
On Error Resume Next
Set rCel = .UsedRange.Find(what:=Cells(x, 9), lookat:=xlWhole)
If rCel Is Nothing Then Set rCel = .UsedRange.Find(what:="JB", lookat:=xlWhole)
iRow = .Cells(rCel.Row - 11, rCel.Column).End(xlDown).Row - 1
.Cells(iRow, rCel.Column) = Cells(x, 1)
.Cells(iRow, rCel.Column + 1) = Cells(x, 2)
.Cells(iRow, rCel.Column + 2) = Cells(x, 3)
Next
.Activate
End With
'
End Sub
Pour éviter les problèmes, quelques précisions pour finaliser :
- quand un rack est plein, comme le OH, où met-on une éventuelle autre ligne OH ;
- pourquoi JB pour remplacer OB ou un autre inexistant, je suppose?
Affaire à suivre...
A+