You are on page 1of 27

Excel

• Topics

• Macros
• Graphs
• Menus
• What is a macro?
• A macro is a set of tasks combined
together so that you can run or replay the
entire task together with a single
command. Macros are a powerful
productivity tool. With macros you can
perform long or boring tasks just by a
single click.
• Each macro has three parts:
• Macro name
• Macro shortcut key
• Macro steps
You store macros in a macro sheet, a
special type of Excel worksheet that is
very similar to a regular worksheet. You
must have a macro sheet open to be able
to use the macros written in that file.
Creating macros using the excel
macro recorder
• The simplest way to create a macro in
Excel is to use the macro recorder.

The first step is to open up the workbook


(file) that you wish to use the macro in.

Then click on Tools ,select Macros and


then select Record new macro from the
menu.
• There are 4 points of interest:
Name - Type the name of your macro.
Shortcut key - (optional) this has to be a letter, we have used h,
so in our example the macro will run every time we hold down the
CTRL key and press the H key.
Store macro in - This would normally be the workbook you are
working on (this workbook), but you can save macros into a
personal macro workbook.
Description - Here you can enter a description of the macro for
your benefit.
When you have finished filling in the information click the OK
button to start the macro recorder.
You will now see the macro recording box as shown below

Everything you do now in the workbook will be recorded, so


manually go through the process that you want your macro
to recreate, for instance adding up a column.
When you have finished click on the small blue square
within the macro recording box to stop recording.
Playing the macro back

To run the macro click on tools, Macro,


then select Macros.

You will see the Macro dialogue box similar


to that shown below, your macro should
be in there ready to use.
• To use the macro simply select it and then click
the Run button.

The macro dialogue box also allows you to delete


and edit macros, for instance by clicking on the
Options button you can assign or change the
keyboard shortcut associated with each macro.

If you have assigned a keyboard shortcut to a


macro then you can run it by holding down the
CTRL key and pressing the associated letter.
Making a Chart or Graph

• Highlight the portion of the worksheet


that you want to depict graphically
• Select the Chart Wizard icon
• Go through Step 1-4
• Charts/graphs can be printed
independently of worksheets by
selecting the chart/graph
Chart Wizard

• To create a chart in Microsoft Excel,


• Select the data you wish to graph and choose
• Chart… from the Insert menu, or click
• on the Chart Wizard () button on the
• standard toolbar.
• Step 1
• Select Standard or Custom Chart Type;
• select Chart sub-type
• The Press and hold to view sample button
• will show you a tiny preview of your data's
• chart
• Step 2:
• Step two allows you to choose the Chart's Source
• Data. This is the data you want to graph. Here we
• can also see a sample of the chart. once data is
• selected, press enter to return to this window.
• From this Data Range tab you can also change
the
• Series in: option, such that instead of charting
the
• data by column, it will chart the data by row.

• Each part of the Chart can be changed with in
• the options. After the chart is created you will
• still be able to change these options
• The Chart title: goes across the top of the
• graph, the Category (X) axis: goes under our
• X-axis labels
• the Value (Y) axis: will be the label
• for the vertical labels
• Step 4:
• This final step is to determine the location of
• your chart. You can place it as a new sheet,
• which will insert a new worksheet into your
• workbook and completely fill the tab with the
• chart such that when you print you will only
• get the chart
• If you place the graph as an object in an
• existing worksheet, it will size to fit within the
• window trying not to cover existing data. With
• this option when you print you will get the data
• on that sheet and the graph
Creating Menus in excel
• You can create new menu items by simply
dropping and dragging command icons on to the
menu bars or tool bars where you want them to
appear, and then assign code to them.
• First, you will need to open the Customize dialog
box, which puts Excel into the Command Bar Edit
mode.  To open this dialog,  select Tool Bars from
the View menu, and choose Customize from the
list.  Or, you can right-click on any empty part of
a tool bar, and choose Customize from the pop
up menu.  The Customize dialog box is show
below.
 
 
 
 
 
 
 
 
 
 
 
 
• From this dialog, choose the Commands
tab, and scroll down to the Macros item in
the Categories list.  Now, choose the
Custom Menu Item in the Commands list,
and drag this to any menu you list. 
Position it in the menu list where you'd
like it to appear.   Now you've created a
new menu item. 
• The next step is to assign
a macro to your new menu
item.    To do this, leave
the Customize dialog open,
and right click on the new
menu item you created.  
The commands for
customizing your new
menu item are on the right
click pop up menu, shown
on the side

• First, type in a name for the menu in the Name
box.  This will assign a name and caption for the
menu item.  Preceding a letter in the name with a
& will underline that character and make it the
menu shortcut key.  If you want to assign a
picture to the menu item, click the Change Button
Image and select one of the built-in menu faces. 
Or, you can create your own face with the Edit
Button Image tool, or copy and paste the face
from another existing button image with the Copy
Button Image and Paste Button Image menu
items. If you're going to have a face for your
button, make sure you choose the Default Style
selection, not the Text Only selection
• Next, you have to assign an existing
macro to the menu item.  Click the Assign
Macro item, and choose an existing macro
from the list.    Once you've done this,
that macro will be run when you click on
the menu item. 
• Your custom menu items and command
buttons are stored in a special file called
Excel.xlb
• They are not stored in the workbook
that happens to be active when you
create them.  Therefore, they will
always be available for you to use. 

You might also like