Sub Init_Palette()
Dim f1 As Worksheet, f2 As Worksheet
Dim i%: i = 2
Dim Départ$, Arrivée$, Poids, Nom
Set f1 = Sheets("Feuil1"): Set f2 = Sheets("Feuil2")
f1.Cells.Clear
With f2
Do While .Cells(i, 2).Value <> ""
Nom = .Cells(i, 1): Départ = .Cells(i, 2).Value ': Arrivée = .Cells(i, 3).Value: Poids = .Cells(i, 4).Value
f1.Range(Départ) = Nom
f1.Range(Départ).Interior.Color = RGB(255, 255, 0)
i = i + 1
Loop
End With
End Sub
Sub Deplacement2_Palette()
Dim f1 As Worksheet, f2 As Worksheet
Dim i%: i = 2
Dim j As Integer
Dim Départ$, Arrivée$, Nom
Set f1 = Sheets("Feuil1"): Set f2 = Sheets("Feuil2")
'on efface la feuille
f1.Cells.Clear
With f2
Do While .Cells(i, 2).Value <> ""
'on récupère le nom de la palette
Nom = .Cells(i, 1)
'on récupère la liste des adresses d'arrivée
Arrivée = .Cells(i, 3).Value
'avec le séparateur "," on en fait un tableau
tabArrivée = Split(Arrivée, ",")
'pour chaque adresse, on met le nom de la palette
For j = LBound(tabArrivée) To UBound(tabArrivée)
f1.Range(tabArrivée(j)) = Nom
f1.Range(tabArrivée(j)).Interior.Color = RGB(255, 255, 0)
Next j
i = i + 1
Loop
End With
End Sub
'Sub Retour2_Palette()
'Dim f1 As Worksheet, f2 As Worksheet
'Dim i%: i = 2
'Dim Départ$, Arrivée$, Poids, Nom
'
'Set f1 = Sheets("Feuil1"): Set f2 = Sheets("Feuil2")
'
'With f2
' Do While .Cells(i, 2).Value <> ""
' Nom = .Cells(i, 1): Départ = .Cells(i, 2).Value: Arrivée = .Cells(i, 3).Value: Poids = .Cells(i, 4).Value
' f1.Range(Arrivée).Resize(Poids).Cut f1.Range(Départ)
' i = i + 1
' Loop
'End With
'
'End Sub
Sub Caseàcocher4_Clic()
If [G12] = False Then
Deplacement2_Palette
ActiveSheet.Shapes("Check Box 4").Select
Selection.Characters.Text = "Replacer au départ"
[A1].Select
Else
Init_Palette
ActiveSheet.Shapes("Check Box 4").Select
Selection.Characters.Text = "Déplacer vers arrivée"
[A1].Select
End If
End Sub