Sunteți pe pagina 1din 7

Lorenzo Ruiz de Manila School

Phase 1 Vista Verde Executive Village Cainta, Rizal

Computer I (First Trimester)


Module #12
Creating Macros
Freezing and Unfreezing Panes

Objectives
At the end of this lesson, the students are expected to:
• understand the functions of macros and freezing panes;
• value the functions of using macros; and
• create a workbook and apply macros on a shape or picture.

Introduction
Most of the times, macros are used in Excel-based exams to clear all of
the answers of the user and prepare the exam for another examinee. On the
other hand, freezing and unfreezing panes are usually done by teachers in
doing there class records. This procedure is helpful to minimize the use of
the scroll bars and to avoid errors in recording grades of the students.

In this lesson you will be guided in answering the following:


• What are macros;
• How to apply and use macros; and
• How to freeze and unfreeze panes;

Macros
Macro contains action or a set of actions that you can use to automate
tasks. Macros are recorded in the Visual Basic for Applications programming
language or by simply recording a macro with MS Excel 2007 commands.
After you create a macro, you can assign it to an object (such as a toolbar
button, graphic, or control) so that you can run it by clicking the object. If
you no longer need to use a macro, you can delete it.

Record a macro
When you record a macro, all steps that are needed to complete the
actions that you want to record are recorded by the macro recorder.
Navigation on the Ribbon is not included in the recorded steps.
1. If the Developer tab is not available, do the following to display it:
• Click the Microsoft Office Button , and then click Excel
Options.
• In the Popular category, under Top options for working
with Excel, select the Show Developer tab in the Ribbon
check box, and then click OK.
2. To set the security level temporarily to enable all macros, do the
following:

o On the Developer tab, in the


Code group, click Macro
Security.

o Under Macro Settings, click


Enable all macros (not recommended, potentially
dangerous code can run), and then click OK.
NOTE: To help prevent potentially dangerous code from running, we
recommend that you return to any of the settings that disable all macros
after you finish working with macros.

3. On the Developer tab, in the Code group, click Record Macro.


4. In the Macro name box, enter a name for the macro.
NOTE: The first character of the macro name must be a letter. Following
characters can be letters, numbers, or underscore characters. Spaces
are not allowed in a macro name; an underscore character works well as
a word separator. If you use a macro name that is also a cell reference,
you may get an error message that the macro name is not valid.

5. To assign a CTRL combination shortcut key (shortcut key: A function


key or key combination, such as F5 or CTRL+A, that you use to carry out a
menu command. In contrast, an access key is a key combination, such as
ALT+F, that moves the focus to a menu, command, or control.) to run the
macro, in the Shortcut key box, type any lowercase letter or uppercase
letter that you want to use.
NOTE: The shortcut key will override any equivalent default Excel
shortcut key while the workbook that contains the macro is open.

6. In the Store macro in list, select the workbook in which you want to
store the macro.
If you want a macro to be available whenever you use Excel, select
Personal Macro Workbook. When you select Personal Macro
Workbook, Excel creates a hidden personal macro workbook
(Personal.xlsb) if it doesn't already exist, and saves the macro in this
workbook. In Microsoft Windows XP, this workbook is saved in the
C:\Documents and Settings\user name\Application
Data\Microsoft\Excel\XLStart folder so that it can be loaded
automatically whenever Excel starts. In Microsoft Windows Vista, this
workbook is saved in the C:\Users\user name\Application
Data\Microsoft\Excel\XLStart folder. If you want a macro in the personal
macro workbook to be run automatically in another workbook, you must
also save that workbook in the XLStart folder so that both workbooks
are opened when Excel starts.
7. To include a description of the macro, in the Description box, type
the text that you want.
8. Click OK to start recording.
9. Perform the actions that you want to record.
10. On the Developer tab, in the Code group, click Stop Recording
. You can also click Stop Recording on the left side of the status bar.

Using Macros Overview


 Record a macro (name the macro and assign a shortcut key)
 Apply several commands
 Stop the recording of the macro
 Insert any picture, object or shape where you will assign the macro
that you recorded
 Test the macro if its working

Freezing and Unfreezing Panes


You can view two areas of a worksheet and lock rows or columns in
one area by freezing or splitting panes (pane: A portion of the document
window bounded by and separated from other portions by vertical or
horizontal bars.). When you freeze panes, you select specific rows or
columns that remain visible when scrolling in the worksheet. Freezing panes

Freeze panes to lock specific rows or columns


1. On the worksheet, do one of the following:
 To lock rows, select the row below where you want the split
to appear.
 To lock columns, select the column to the right of where you
want the split to appear.
 To lock both rows and columns, click the cell below and to
the right of where you want the split to appear.
2. On the View tab, in the Window group, click Freeze Panes, and
then click the option that you want.

NOTE: When you freeze panes, the Freeze Panes option changes to
Unfreeze Panes so that you can unlock frozen rows or columns.

Activity
Direction: Follow the instructions below.
Applying Macros
1. Open MS Excel 2007
2. Record a macro with the following actions: Name the macro as your
surname.
a. Select range A1:A10 (Sheet1) Right-click on the range of cell and
choose ‘clear contents’
b. Select range A1:B20 (Sheet2) Right-click on the range of cell and
choose ‘clear contents’
c. Select range A1:C30 (Sheet3) Right-click on the range of cell and
choose ‘clear contents’
3. Assign the macro that you recorded to a rectangular box. Name the
rectangular box as “CLEAR CONTENTS”
4. Test the macro by clicking on the rectangular box.

Freezing and Unfreezing Pane


1. Click on cell A2
2. On the Ribbon – View tab – Window group, click on the ‘freeze panes’
command
3. Navigate the entire worksheet using the horizontal and vertical scroll
bar. Notice what will happen on the worksheet.
4. In your own words, write a 3-sentence paragraph explaining the
functions of freezing and unfreezing panes.

Reference:
Microsoft Office Excel Help

Things to Remember
• Formulas are equations that perform calculations on
values in your worksheet. A formula starts with an equal
sign (=).
• A formula can also contain any or all of the following:
functions, references, operators, and constants
• Functions are prewritten formula that takes a value or values, performs
an operation, and returns a value or values. Use functions to simplify
and shorten formulas on a worksheet, especially those that perform
lengthy or complex calculations.
• Constants are value that is not calculated and, therefore, does not
change. For example, the number 210, and the text "Quarterly
Earnings" are constants. An expression, or a value resulting from an
expression, is not a constant.
• Operators are sign or symbol that specifies the type of calculation to
perform within an expression. There are mathematical, comparison,
logical, and reference operators.
• There are four different types of calculation operators: arithmetic,
comparison, text concatenation, and reference.
Arithmetic Exampl
operator Meaning e
+ (plus sign) Addition 3+3
– (minus sign) Subtraction 3–1
Negation –1
* (asterisk) Multiplication 3*3
/ (forward Division 3/3
slash)
^ (caret) Exponentiatio 3^2 • A
n) SmartArt
graphic is a visual representation of your information and ideas. You
can create SmartArt graphics by choosing from among many different
layouts to quickly, easily, and effectively communicate your message.
• In creating SmartArts you must do the following procedures:
o On the Insert tab, in the Illustrations group, click SmartArt.
o In the Choose a SmartArt Graphic dialog box, click the type
and layout that you want.
o Enter your text by doing one of the following:
 Click in a shape in your SmartArt graphic, and then type
your text.
 Click [Text] in the Text pane, and then type or paste your
text.
 Copy text from another program, click [Text], and then
paste into the Text pane.
• In creating Charts you must remember the following procedures:
Creating Charts:
1. Enter the chart data on a worksheet
2. Select the Chart data
3. Select the Chart Type (Ribbon – Insert tab – Charts group)
4. Format the Chart using the Design, Layout and Format tab
• Macro contains action or a set of actions that you can use to automate
tasks. Macros are recorded in the Visual Basic for Applications
programming language or by simply recording a macro with MS Excel
2007 commands.

Test Yourself
Direction: Complete the table below with the correct functions of each
formula. The first column is done for you.
Example formula What it does
=SUM(A1:A5) Adds the numbers from A1 up to A5
=AVERAGE(B1:C4)
=COUNT(B1:D10)
=SUBTRACT(B1,B2)
=PRODUCT(B1:B5)
=QUOTIENT(C1,C2)
=MAX(B1:B10)
=MIN(B1:B10)
=CONCATENATE(A2,B2
and C2)

Direction: Identify what type of SmartArt must be used in each item.


____________ 1. A SmartArt that shows a continual process.
____________ 2. A SmartArt used in creating an organization chart.
____________ 3. A SmartArt used to show proportional relationships with
the largest component on the top or bottom.
____________ 4. A SmartArt that shows nonsequential information.
____________ 5. A SmartArt that shows a continual process.

Direction: Identify the steps in inserting charts in MS Excel 2007 (10 pts).
Explain each step and describe how to format Chart Titles, Legends, Data
Labels and etc. You will be graded using the following rubric:
Rubrics in Inserting Charts
5 4 3 2 1
Appropriate order of
steps in creating charts
Clarity of ideas – correct
explanation on steps.

S-ar putea să vă placă și