THE GOAL β€’ CBSE CLASS 10 β€’ INFORMATION TECHNOLOGY 402

Part B β€” Electronic Spreadsheet (Advanced)

Chapter 5 β€’ Using Macros in Spreadsheet

πŸ“Š CHAPTER 5 β€’ EXAM-ORIENTED NOTES

Using Macros in Spreadsheet

This chapter explains how macros can be used to automate repeated tasks in LibreOffice Calc.

✍️ NOTES ONLY β€’ NO TOP 50 TEST

Source: NCERT Domestic Data Entry Operator β€” Class X, 2023–24, Part B, Unit 2, Chapter 5.

πŸ—ΊοΈ Chapter Roadmap

01. Introduction to Macros

Many spreadsheet tasks are performed repeatedly. For example, entering the same school name, address or contact information with a particular format, or applying the same formula to different sheets.

Performing such tasks manually again and again can take time and may lead to typing or formatting mistakes.

A Macro can be used to automate repeated tasks that are performed in the same way repeatedly.

Definition of Macro

A macro is a single instruction that executes a set of instructions.

These instructions may be a sequence of commands or keystrokes that can be used any number of times later.

⭐ EXAM DEFINITION

Macro is a single instruction that executes a set of instructions.

02. Advantages of Macros
🧠 Remember:

Repeated Task β†’ Record Once β†’ Run Again

03. Enabling Macro Recording

By default, the macro recording feature is turned off when LibreOffice is installed.

Therefore, before recording a macro, macro recording must be enabled.

Steps to Enable Macro Recording

  1. Click Tools on the main menu bar.
  2. Select Options.
  3. Select LibreOffice.
  4. Select Advanced.
  5. Under Optional Features, locate Enable macro recording.
  6. Put a check mark on Enable macro recording.
⭐ VERY IMPORTANT MENU PATH

Tools β†’ Options β†’ LibreOffice β†’ Advanced

04. Recording a Macro

Once macro recording has been enabled, the Record Macro option becomes available under the Tools β†’ Macros menu.

Procedure

  1. Click Tools β†’ Macros β†’ Record Macro.
  2. Start performing the actions that you want to record.
  3. When recording starts, a small alert is displayed.
  4. Click Stop Recording when the required actions are completed.
  5. The Basic Macros dialog box opens.
  6. Select the object where the macro has to be saved.
  7. Give the macro a suitable name.
  8. Click Save.
⭐ EXAM PATH

Tools β†’ Macros β†’ Record Macro

05. Actions Recorded by Macro

The Macro Recorder records keyboard and mouse actions performed during the recording.

However, some actions are specifically not recorded.

Actions NOT Recorded

Important: Selections are recorded only when they are made using the keyboard/cursor movement, not when the mouse is used for selection.

🧠 Exam Fact:

The macro recorder works only in Calc and Writer.

06. Saving a Macro

After recording is stopped, the Basic Macros dialog appears.

The recorded macro can then be saved in the required object/library.

Important Points

⭐ REMEMBER

Default Macro Name β†’ Main
Default Library β†’ Standard Library
Default Module β†’ Module1

07. Library and Module

Library

A Library is a collection of modules.

Module

A module contains macros. Therefore:

Library β†’ Modules β†’ Macros

A Library is a collection of modules, which in turn is a collection of macros.

08. Macro Naming Rules

The chapter specifies rules that must be followed while naming a Macro, Module or Library.

Rule Requirement
First character Name should begin with a letter.
Spaces Spaces are not allowed.
Special characters Special characters are not allowed except underscore (_).

Examples

FormatHeading

Format_Heading

Names such as the following are invalid:

1formatword
format word
format*word
⭐ EXAM TRAP

Format_word is valid because underscore is allowed.

format word is invalid because spaces are not allowed.

09. Running a Macro

A previously created macro can be run whenever the same task is required again.

Procedure

  1. Type the required heading or data in the worksheet.
  2. Click Tools β†’ Macros β†’ Run Macro.
  3. The Macro Selector dialog box opens.
  4. Select the required library and module.
  5. Select the required macro from the Macro Name list.
  6. Click Run.
⭐ VERY IMPORTANT

Tools β†’ Macros β†’ Run Macro

10. Macro Libraries
Library Meaning
LibreOffice Macros Provided by LibreOffice and contains modules with prerecorded macros. It should not be changed.
My Macros Contains macros that we write or add to LibreOffice.
Untitled1 Name of the worksheet being worked on when it has not yet been saved with another name.
⭐ DIRECT EXAM POINT

LibreOffice Macros library contains prerecorded macros and should not be changed.

11. Macro Code and BASIC

The actions recorded by a macro are stored as instructions in a programming language called BASIC.

BASIC is the programming language used for the recorded macro instructions in Calc.

Viewing Macro Code

The generated macro code can be viewed through:

Tools β†’ Macros β†’ Edit Macros

The selected macro's associated code can be viewed in the IDE.

⭐ WARNING FROM TEXTBOOK

Macro code should not be changed unless you have knowledge of the language in which it is written.

12. Structure of Macro Code

The code of a macro begins with Sub followed by the name of the macro and ends with End Sub.

Sub FormatHeading
    ' Macro instructions
End Sub
⭐ FILL IN THE BLANK

Macro code begins with Sub and ends with End Sub.

13. Creating and Organising a Simple Macro

Macros can also be organised manually by creating libraries and modules.

Opening Basic Macro Organiser

  1. Click Tools β†’ Macros β†’ Organize Macros β†’ LibreOffice Basic.
  2. The LibreOffice Basic Macro dialog opens.
  3. Click Organizer.
  4. The Basic Macro Organizer opens.

Creating a Library

To create a new library containing modules:

Library β†’ New

The newly created library can then be used to organise modules and macros.

⭐ MENU PATH

Tools β†’ Macros β†’ Organize Macros β†’ LibreOffice Basic

14. IDE β€” Integrated Development Environment

The chapter introduces the IDE for viewing and editing macro code.

IDE stands for Integrated Development Environment.

The IDE displays the programming code associated with the macro.

🧠 Exam Memory:

IDE = Integrated Development Environment

15. Macro as a Function

The chapter also explains that a macro can be used as a function in Calc.

A macro used as a function can accept arguments/values and return a result/value.

Macro as Function β†’ Accepts arguments/values β†’ Returns result/value

Difference from Normal Macro

Macro Macro as Function
Executes a set of recorded/programmed instructions. Can accept input values and return a result/value.
Used mainly for automation of tasks. Can be used in a spreadsheet formula-like manner.
16. Arguments and Return Value

Arguments / Values

Arguments are the input values supplied to a macro function.

Result / Value

The return value is the result produced by the macro function.

Input / Arguments β†’ Macro Function β†’ Result / Value
⭐ FILL-IN-THE-BLANK FOCUS

A macro as a function is capable of accepting arguments/values and returning a result/value.

17. Function Example β€” Number of Tiles

The textbook demonstrates a macro as a function using a calculation for the number of tiles required.

The macro function accepts required values and returns the calculated result.

The important concept is not merely the example, but the way a macro can be designed to accept values and return a result.

18. Running a Macro from IDE

The chapter also covers execution of a module from the IDE.

⭐ EXAM FACT

A module can be executed from the IDE by pressing F5.

19. Important Macro Terms
Term Exam-Oriented Meaning
Macro Single instruction that executes a set of instructions.
Macro Recorder Records a sequence of actions.
Library Collection of modules.
Module Contains macros.
BASIC Programming language used for macro instructions.
IDE Integrated Development Environment.
Macro Selector Dialog used to select and run a macro.
Standard Library Default library in which the default macro is saved.
Sub Beginning of macro code followed by macro name.
End Sub End of macro code.
20. πŸ”₯ Important Menu Paths
Task Menu Path
Enable Macro Recording Tools β†’ Options β†’ LibreOffice β†’ Advanced
Record Macro Tools β†’ Macros β†’ Record Macro
Run Macro Tools β†’ Macros β†’ Run Macro
Edit Macro Tools β†’ Macros β†’ Edit Macros
Organise Macros Tools β†’ Macros β†’ Organize Macros β†’ LibreOffice Basic
21. πŸ“Œ High-Priority Exam Facts
22. 🧠 Chapter 5 Exam Comparison
Question Type Answer to Remember
What is a Macro? Single instruction executing a set of instructions.
Default macro recording status? Turned off.
Programming language? BASIC.
Default macro name? Main.
Default library? Standard Library.
Library contains? Modules.
Module contains? Macros.
Macro code begins with? Sub.
Macro code ends with? End Sub.
IDE full form? Integrated Development Environment.
Macro function accepts? Arguments / values.
Macro function returns? Result / value.
IDE module execution key? F5.
23. 🎯 Check Your Progress β€” What to Prepare

The textbook's Check Your Progress for Chapter 5 focuses on the following areas:

⭐ EXAM PRIORITY

These topics are directly reflected in the chapter's own Check Your Progress and answer key, so they should be given high priority while preparing for the examination.

24. πŸ’Ž RPAID REVISION

⚑ CHAPTER 5 β€” RPAID REVISION

  • Macro β†’ Single instruction that executes a set of instructions.
  • Purpose β†’ Automate repeated tasks.
  • Default recording β†’ OFF.
  • Enable recording β†’ Tools β†’ Options β†’ LibreOffice β†’ Advanced.
  • Record Macro β†’ Tools β†’ Macros β†’ Record Macro.
  • Run Macro β†’ Tools β†’ Macros β†’ Run Macro.
  • Edit Macro β†’ Tools β†’ Macros β†’ Edit Macros.
  • Organize Macros β†’ Tools β†’ Macros β†’ Organize Macros β†’ LibreOffice Basic.
  • Default Macro Name β†’ Main.
  • Default Library β†’ Standard Library.
  • Default Module β†’ Module1.
  • Library β†’ Collection of modules.
  • Module β†’ Collection/container for macros.
  • BASIC β†’ Programming language for macro code.
  • IDE β†’ Integrated Development Environment.
  • Macro Code β†’ Sub ... End Sub.
  • Macro as Function β†’ Arguments/values β†’ Result/value.
  • IDE execution β†’ F5.
  • Naming Rule β†’ Begin with a letter.
  • No spaces in Macro, Module or Library names.
  • Special characters are not allowed except underscore (_).
  • LibreOffice Macros β†’ Prerecorded macros; should not be changed.
  • My Macros β†’ Macros written or added by us.