Easiest way is to turn on the macro recorder...
Tools>Macro>Record new macro...
then go through a series of actions in your spreadsheet as you normaly would,.. actions like cut or copy and paste,....select different sheets, or an object like a chart and change some stuff.
then stop the recorder,... and hold down Alt while pressing F11 (this takes you to the vba editor,) the you can examine the code that the macro recorder wrote.
If you know some VBA statements or commands, you can then edit or modify the code to do things on conditions or pass variables to the code.