0% found this document useful (0 votes)
250 views

Comprehensive Notes Use Macros in Spreadsheet Information Technology Class 10 - TutorialAICSIP

Uploaded by

kvbsd13
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
250 views

Comprehensive Notes Use Macros in Spreadsheet Information Technology Class 10 - TutorialAICSIP

Uploaded by

kvbsd13
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

TutorialAICSIP 

A best blog for CBSE Class IX to Class XII

This site uses Google AdSense ad intent links. AdSense automatically generates these links and they may help creators earn money.

Comprehensive
notes Use macros in
spreadsheet
information
technology class 10

In this article I am going to provide a comprehensive notes


Use macros in spreadsheet information technology
class 10. Here we start!

Topics Covered
1. Use macros in spreadsheet Information Technology
class 10
2. Record macro
2.1. Rules of naming macro
3. Running a macro

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 1/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP
4. Creating and Organizing a simple macro
4.1. Creating a new library to store a macro
4.2. Creating a new module to store a macro
5. Macro As Function
5.1. Creating a macro as a function
6. Passing Argument to Macro Function
7. Using Macro function in Libre Office by Passing
Argument
8. Passing the arguments as values
9. Macros to work like built- in functions
10. Accessing cells directly
11. Sorting

Use macros in
spreadsheet Information
Technology class 10
While working with spreadsheet we need few tasks to be
repeated again and again. Macros allow to automate
repeated tasks in the same way over and over again.

Macro is a powerful feature of spreadsheet that allows to


record a set commands performed by user and can be run
anytime are per the requirement.

Macros needs to be created. It can be recorded before use.


Now let us see how to record a new macro in spreadsheet.

Record macro
Macro records a series of commands or keystrokes in
spreadsheet. These can be recorded one time and then can
be used number times later.

By default, in Libre Office Calc the macro recording feature


is not active. So ensure that it should be activated before
recording macro. To activate macro in Libre Office Calc,
follow these steps:

Observe these screenshots:

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 2/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Macro cannot record the following commands:

1. Opening windows
2. Action carried out in another window than where
recording was started
3. Window switching
4. Action not related to the spreadsheet contents
5. Selection will be recorded only if the they are done by
using keyboard
6. The macro recorder works only in calc and writer

Follow the given steps to record a macro:

[1] Click on Tools > Macros > Record Macro option. Stop
recording button will open.

[2] Perform the commands or actions which needs to be


recorded. Now click on Stop Recording option.

[3] It will open basic macros dialog box with Macro Name,
Save Macro in, Existing Macros in etc.
https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 3/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

[4] The by default macro name is Main and saved in


standard in the Standard Library in module1. Macro name
can be changed.

[5] Click on Save button.

Rules of naming macro


Spreadsheet follows some rules for naming a macro. They
are :

1. Macro name always starts with alphabet


2. Macro name does not contain a letter
3. Macro name does not contain a special character except
uderscore

Running a macro
To run a macro in libre office calc, follow these steps:

[1] Place the cursor from where the macro needs to be


recorded.

[2] Click on Tools > Macros > Run Macro option.

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 4/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

[3] Macro select dialog box window will appear as displayed


in below given screenshot:

[4] Select the library which contains macro module and


select the name of macro. Click on Run button.

Creating and Organizing a


simple macro
Organizing macro is important tool in spreadsheet
software. In a spreadsheet, there may be various macros
created by user for different purposes. When macro is
created, either it is created through new library or existing
module stored in a library.

Follow the given steps to organize macro:

[1] Click on Tool > Macros > Organize Macros > Basic
option.

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 5/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

[2] It will open the LIbreOffice Basic Macro dialog box


window as displayed in below screen shot.

[3] The basic organizer dialog box will appear as displayed in


below screenshot:

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 6/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

This dialog box has following basic components:

Creating a new library to store


a macro
To create a new library click on Libraries tab > Choose the
location and Library and click on New button.

[2] Type the new Name for library and click on OK.

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 7/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Creating a new module to


store a macro
Click on Modules tab > New Button. Type new module Name
and click on OK.

Macro As Function
Sometimes we need to do some tasks repetitively in
spreadsheet. For example a same formula is used
frequently in spreadsheet on different cells and there is no
predefined function for it.

In this scenario, Macro will be created, that performs the


calculations. This will save time and efforts to type the
desired formulas. These macros can be created Macro As
Function.

Discover related topics

Information Technology Class 10

Social Science

Excel Automation Tools

Excel Sheet Automation

Macro Excel Sheet

A function is created in macro editor in between Function


and End Function block.

Function <Function_Name>
tasks
End Function

A function can accept arguments or values. Some


operations can be performed on these arguments and
result is returned.

Creating a macro as a function


Let see how to create a macro as function, Observe the
scenario and open the code editor for writing a function.

I am writing a function which returns a pie value


spreadsheet. Create a new spreadsheet or edit existing
macro. Follow the given steps:

1. Click on Tools > Macros > Edit Macros option.


2. Now choose the module to write function.
3. Type the desired code for a function.

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 8/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

4. Save the code and close editing window.

Code for accepting pie value:

Option Explicit

Sub Main

End Sub

Function pie_val()
pie_val=3.14
End Function

Using a function
Open spreadsheet and type the function with = sign as
below:

=pie_val()

Press enter key and see the result.

Passing Argument to
Macro Function
A function may have some arguments. A macro function
can accept some arguments as values and as references.
Let us create a macro function that accept two values and
display the large number.

Edit macro as suggested above and write code as below:

Function two_max(x,y)
If x>y Then
two_max=x
Else
two_max=y
End IF
End Function

Using Macro function in


Libre Office by Passing
Argument
In spreadsheet, the function is used by writing = sign
followed by function name with arguments. Have a look at
this website.

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 9/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

The above function will return maximum value from given


two numbers.

Output 1:

Output 2:

Passing the arguments as


values
Arguments passed to macro function as a value. It is not
possible to know which cells are used. User is will provide
the referenced cells rather than values. These reference
can be provided either range as string or parse string and
obtain values in the referenced cells.

Macros to work like built-


in functions
The normal macro functions are something which is not
really behave as built-in functions. Macros does not
appear in the built-in functions list. It is only possible to
write functions as they behave like built-in function by
writing add-in.

Accessing cells directly


Libre Office Calc internal objects can be directly
manipulated in CALC spreadsheet. To access a cell in
spreadsheet ThisComponent is automatically set to the
reference. A Calc document contains sheets and the macro
accesses these via a call to ThisComponent.getSheets().
Use getCellByPosition(col, row) to return a cell at a
specific row and column.

Function SumCellsAllSheets()
Dim TheSum As Double
Dim i As integer

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 10/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP
Dim oSheets
Dim oSheet
Dim oCell
TheSum = 0
oSheets = ThisComponent.getSheets()
For i = 0 To oSheets.getCount() - 1
oSheet = oSheets.getByIndex(i)
oCell = oSheet.getCellByPosition(0, 1) ' GetCell A2
TheSum = TheSum + oCell.getValue()
Next
SumCellsAllSheets = TheSum
End Function

Sorting
For sorting in through macros, following functions are
useful:

1. oSortFields(): Sort the data in different fields


2. oSortDesc(): Sort the data in descending order
3. oCellRange(): Specifies the cell ranges for sorting
4. oSheet():Refers a sheet

Observe this code:

Sub SortRange
Dim oSheet ' Calc sheet containing data to sort.
Dim oCellRange ' Data range to sort.
REM An array of sort fields determines the columns that
are
REM sorted. This is an array with two elements, 0 and 1.
REM To sort on only one column, use:
REM Dim oSortFields(0) As New com.sun.star.util.SortField
Dim oSortFields(1) As New com.sun.star.util.SortField
REM The sort descriptor is an array of properties.
REM The primary property contains the sort fields.
Dim oSortDesc(0) As New com.sun.star.beans.PropertyValue
REM Get the sheet named "Sheet1"
oSheet = ThisComponent.Sheets.getByName("Sheet1")
REM Get the cell range to sort
oCellRange = oSheet.getCellRangeByName("A1:C5")
REM Select the range to sort.
REM The only purpose would be to emphasize the sorted
data.
'ThisComponent.getCurrentController.select(oCellRange)
REM The columns are numbered starting with 0, so
REM column A is 0, column B is 1, etc.
REM Sort column B (column 1) descending.
oSortFields(0).Field = 1
oSortFields(0).SortAscending = FALSE
REM If column B has two cells with the same value,
REM then use column A ascending to decide the order.
oSortFields(1).Field = 0
oSortFields(1).SortAscending = TRUE

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 11/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP
REM Setup the sort descriptor.
oSortDesc(0).Name = "SortFields"
oSortDesc(0).Value = oSortFields()
REM Sort the range.
oCellRange.Sort(oSortDesc())
End Sub

Watch this video for more practical understanding of the


topics:

IT 402 Information Technology Use macros in sp…


sp…

That’s all from use macros in spreadsheet information


technology class 10. I hope you enjoyed this article. Feel
free to share your valuable feedback in the comment
section.

        

 Comprehensive note for


class 10 share and review a
spreadsheet with libre
office calc

By tutorialaicsip

More on this

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 12/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP
Comprehensive note for class 10 share and
review a spreadsheet with libre office calc

Comprehensive notes Link spreadsheet data with


Libre Office Calc For Class 10

Comprehensive notes Class 10 Analyse data


using scenarios and goal seek with Libre Office…

Leave a Reply
You must be logged in to post a comment.

Trending

Important QnA Working with functions Class 12

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 13/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Important Data Structure stack Class 12


Questions

Important Questions AI Class 7 Chapter 1


Introduction to AI

NCERT Solutions Chapter 4 Plotting Data using


Matplotlib – Easy and Concise

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 14/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Important Artificial Intelligence Class 9 Book


Complete PDF 2022-23

Important Assignment boolean logic class 11

Data file handling in python class 12 important


questions

Working with Functions XII – 13 Output & Error


Questions with easy solutions

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 15/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

AI Ethics Class 10 40+ Important Question


Answers

Important Plotting with pyplot Assignments


Class-12 IP

Latest

NCERT solutions Information Technology Chapter 8


Introduction to Database Management System

NCERT solutions Information Technology Class 10 Chapter 7


Share and Review a Spreadsheet

NCERT solutions Information Technology Class 10 Chapter 6


Linking Spreadsheet Data

NCERT Solutions Information Technology Class 10 Chapter 5


Using Macros in Spreadsheet

NCERT solutions Information Technology Class 10 Chapter 4


Analyse Data Using Scenarios and Goal Seek – A
comprehensive Guide

Comprehensive notes Use macros in spreadsheet information


technology class 10

Comprehensive Guide NCERT Solutions Chapter 3 Advanced


features of writer

Comprehensive Guide NCERT Solutions Chapter 2 Working with


Images Libre Office Writer

Comprehensive Guide NCERT Solutions Chapter 1 Introduction


to Styles Class 10 IT 402

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 16/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Comprehensive note for class 10 share and review a


spreadsheet with libre office calc

What You missed

Comprehensive notes Use macros in spreadsheet information


technology class 10

Comprehensive note for class 10 share and review a


spreadsheet with libre office calc

Comprehensive notes Link spreadsheet data with Libre Office


Calc For Class 10

Comprehensive notes Class 10 Analyse data using scenarios


and goal seek with Libre Office Calc

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 17/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Comprehensive notes Create table of contents with libre office


writer Information Technology 402 class 10

Comprehensive notes Create and use template Information


Technology Class 10 with Libre Office

Comprehensive notes Insert and use images in document class


10 with libre office

Comprehensive notes Apply styles in the document IT 402


Class 10 with libre office

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 18/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Comprehensive Notes Self Management Skills Class 10

Comprehensive notes Unit 1 Communication Skills II Class 10

Comprehensive Notes Prevent Accidents and Emergencies


Class 10

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 19/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Comprehensive notes WorkPlace Safety Class 10

Internet security class 10 notes and Comprehensive guide

Comprehensive Notes Online Transaction Class 10 IT 402

Comprehensive notes Create and Publish Blog class 10

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 20/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Comprehensive notes on Instant Messaging Class 10

Comprehensive notes Networking Fundamentals Class 10

Comprehensive Notes working with accessibility options Class


10

Comprehensive notes Creating reports Class 10 IT 402

Comprehensive notes on Forms using wizard Class 10 IT 402

Rate our website

Name (required)

Email (required)

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 21/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Please rate our website (required)


1 - Very Bad

2 - Poor

3 - Average

4 - Good

5 - Excellent

How could we improve? (required)

Send Feedback

Important Site Links


Privacy Policy
Contact Us
Terms & Conditions
Disclaimer
About us – TutorialAICSIP educational blog
Computer Science Class 12 Notes A Comprehensive Guide
Informatics Practices Class 12 Notes Comprehensive Study Material
An easy explanation for Courses on TutorialAICSIP for 9 to 12
Home – TutorialAICSIP comprehensive blog for CBSE 10, 11, 12
10+ Solved IP Class 12 Term 2 Sample Paper 2022 – Important
Most Useful Sample Paper Computer Science Class 12
100+ Important and Most expected questions IP Class 12
100+ Important Most expected questions Computer Science Class 12
CUET Computer Science Informatics Practices 308 Comprehensive Notes
important CUET UG 2022 sample questions Computer Science
Python tkinter Tutorial for Class 12 Comprehensive Guide
200 + Important CBSE Computer Science Class 12 previous year questions
Embed iList
Sample Papers
Class 11
TutorialAICSIP Forum Registration
TutorialAICSIP Forum Login
TutorialAICSIP Forum Password Reset
TutorialAICSIP Forum – A community of learners and educators
Comprehensive guide Chapter Wise NCERT solutions Class 10 Information Technology

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 22/23
8/9/24, 1:44 PM Comprehensive Notes Use Macros In Spreadsheet Information Technology Class 10 | TutorialAICSIP

Important Content at a Glance


200 + Important CBSE Computer Science Class 12 previous year questions
A comprehensive notes for Informatics Practices with Python – CBSE Curriculum Class 11 and 12
AI Class 10 AI Project Cycle Revision Notes Very Important
An easy explanation for Courses on TutorialAICSIP for 9 to 12
Class 11
Comprehensive guide Chapter Wise NCERT solutions Class 10 Information Technology
Comprehensive notes Artificial Intelligence Class 9 CBSE
Comprehensive notes CBSE Computer Science 2022-23
Comprehensive study Material CBSE Computer Applications Class 10
Computer Science Class 12 Notes A Comprehensive Guide
CUET Computer Science Informatics Practices 308 Comprehensive Notes
Embed iList
important CUET UG 2022 sample questions Computer Science
Informatics Practices Class 12 Notes Comprehensive Study Material
Information Technology 402 Class 10 notes complete Study Material accomplish your goal
Python tkinter Tutorial for Class 12 Comprehensive Guide
Sample Papers
TutorialAICSIP Forum – A community of learners and educators
TutorialAICSIP Forum Login
TutorialAICSIP Forum Password Reset
TutorialAICSIP Forum Registration

Copyright © 2024 TutorialAICSIP

Powered by TutorialAICSIP

https://www.tutorialaicsip.com/it-402-x/comprehensive-notes-use-macros-in-spreadsheet-information-technology-class-10/ 23/23

You might also like