Removing all puzzle pieces is done using the procedure DeleteAllShapes() , which is called at multiple points in the program:

Code
Sub DeleteAllShapes()
Dim ShapeObj As Shape
ThisWorkbook.Worksheets("Sheet1").Activate
ActiveWindow.DisplayGridlines = False
For Each ShapeObj In ActiveSheet.Shapes
ShapeObj.Delete
Next ShapeObj
Set ShapeObj = Nothing
End Sub
Explanation:
In Excel, inserting an image from a file is done by going to the Insert tab and clicking on the Pictures button. After selecting the image file, it is inserted into the workbook as an object.
When inserted, the image becomes part of the worksheet’s Shapes collection. This collection includes all objects like pictures, charts, buttons, etc.
The DeleteAllShapes() procedure:
- Activates the worksheet named
"Sheet1". - Hides the gridlines in the active window by setting
ActiveWindow.DisplayGridlines = False. - Uses a
For Eachloop to iterate through all shapes on the active sheet. - Deletes each shape using the
.Deletemethod. - Cleans up by setting the shape object variable to
Nothing.