Excel does its work on “Objects” (= parts or components of Excel). A cell is an example of an object, as is a “Range” of cells (actually they might be the most common objects you end up targeting with your macros). There are lots and lots of other objects as well. An Excel chart is an object, as is a tab within an Excel workbook. What’s going to help you here is using the macro recorder and selecting the objects (e.g. cells, ranges of cells, whole rows, whole columns, whole tabs, charts etc) and looking at the code that is produced by the recorder.
- If you’re interested in objects you also need to look at what we have to say about “Properties” and “Methods” because it all kind of fits together. We explain more about this here: Excel’s macro object-property-method structure. When you read the properties definition you’ll find that you can set properties within properties (the example we use is the bold property, which is part of the font property for the “Active cell“). Pursuing the theme, you’ll find that you can select (smaller) objects within (bigger) objects quite happily. For example, you could select a chart object within an Excel tab or worksheet if you wanted to. Here we’re trying to introduce you to the idea that there could be such a thing as an object hierarchy.
- As mentioned above, rely on the wonderful “Macro recorder” to get you started on selecting objects you’re interested in to start. You’ll find yourself happily targeting an Excel object (e.g. a cell) and applying methods to that object (like copy) or setting properties for that object (like font settings).
O stands for “Operators”. You really need to read what we’ve got to say about “Worksheet functions” and “Variables” as well if you want to think about operators. You can perform basic mathematical operations on variables (plus +, minus -, times *, divide /, to the power of ^). It’s a way of manipulating numbers in VBA but you might find you prefer “Worksheet functions” because those ones enable you to access the regular formulas you’re used to in Excel.