Sub Generer_clavier()
On Error GoTo fini
i = 0
Position = 50
largeur = 12
Sheets.Add
For i = 21 To 105
[a1].Select: DoEvents
'--------------- ajoute une touche
ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, 50#, 50, 14#, 60).Select
Set Sh = Selection.ShapeRange
Sh.Top = 100
Sh.Name = "Touch" & Format(i, "000")
Sh.Line.ForeColor.SchemeColor = 8
Sh.Line.Weight=2
x = i Mod 12
'-------------- positionne et colorie la touche
Select Case x
Case 1, 3, 6, 8, 10 ' ----blanche
Sh.Left = Position - ((largeur / 2) - 1)
Sh.Height = 60
Sh.Width = largeur - 2
Sh.ZOrder msoBringToFront
Sh.Fill.ForeColor.SchemeColor = 8
Sh.Fill.BackColor.SchemeColor = 23
Sh.Fill.TwoColorGradient msoGradientHorizontal, 3
Case Else
Sh.Left = Position ' ----- noire
Sh.Height = 90
Sh.Width = largeur
Sh.ZOrder msoSendToBack
Sh.Fill.ForeColor.SchemeColor = 26
Sh.Fill.BackColor.SchemeColor = 9
Sh.Fill.TwoColorGradient msoGradientDiagonalUp, 3
Position = Position + largeur
End Select
Next
' ----------------affectation macro aux touches
'ActiveSheet.DrawingObjects.Select
'Selection.OnAction = "MousePlay"
'-----------------
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 30, 80, 640, 130).Select
Selection.ShapeRange.Fill.PresetTextured msoTextureWalnut
Selection.ShapeRange.ZOrder msoSendToBack
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
fini:
End Sub