Inserting shapes and naming them in Excel is key in the development process.
All of the instructions and shortcuts in this small shot are based on Microsoft Excel 2016 for Windows.
Steps to insert a shape in Excel.
- Start Excel and Create a New Book or Sheet
The shortcut to create a new sheet in Excel is function key 11 (or F11). Otherwise, select (1) File, (2) New, (3) Blank workbook from the menu. Or, just press Ctrl-N.
- Insert a Shape
Click (1) Insert from the menu, and under (2) Illustrations, select a shape under the (3) Shapes list. In our case, we chose the (4) oval shape, under Basic Shapes. Click anywhere on the sheet, and your selected shape will appear.
Naming a Shape
When you name a shape, it makes it easier to refer to it in code.
Follow the steps below to name a shape.
- Select your shape.
Click on your shape. You should see selection nodes around it after you select it.
- Name it.
On the formula toolbar, there should be an input box on the far left. This is also known as the name box. Click in the (1) Name Box and type in a custom name for your selected shape. In our case, we named our shape objPiece1. Press Enter after you type in a name.
Note: Notice how we use camel case (camelCase) to name our object. It helps distinguish between different words. In addition, we like to prefix our names. For example, a good prefix for a text box object would be txt.
There you have it. Now, you may not see the usefulness of what you just did. However, you just took a big step into learning how to design stuff in Excel. Going forward, we will expand on this knowledge.
By the way, we used this method you just learned to create our SpinDip Match game. Hopefully, we can get deeper into this subject, allowing you to create your own game in Excel.
See the links below for more information on this subject.