Après plusieurs essais, Le code suivant semble fonctionner.
Sub shape()
ActiveSheet.Calculate
Dim x As Integer
Application.ScreenUpdating = False
With ActiveSheet
On Error Resume Next
For Each sh In ActiveSheet.Shapes
If Not sh.Name Like "Bouton" Then sh.Delete
Next sh
For x = 1 To 8
If Cells(1, x).Value = 1 Then
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 40, 40, 40, 40)
.Name = ("figure " & x)
.Top = Cells(5, x).Top + (Cells(5, x).Height - .Height) / 2
.Left = Cells(5, x).Left + (Cells(5, x).Width - .Width) / 2
End With
ElseIf Cells(1, x).Value = 2 Then
With ActiveSheet.Shapes.AddShape(msoShapeOval, 40, 40, 27, 40)
.Name = ("figure " & x)
.Top = Cells(5, x).Top + (Cells(5, x).Height - .Height) / 2
.Left = Cells(5, x).Left + (Cells(5, x).Width - .Width) / 2
End With
End If
Next x
End Sub