Writing a Macro in LibreOffice Calc - A Comprehensive Guide

November 2, 2023 1.2K views

Dive into our guide on LibreOffice Calc macros, designed for content writers and office app aficionados. Unleash the power of automation and supercharge your productivity. Let's transform the way you work!

Part 1: What is the macro in LibreOffice Calc?

LibreOffice Logo.

A macro in LibreOffice Calc is a set of recorded actions that can be replayed to automate repetitive tasks. It allows users to perform complex operations with a single click, saving time and effort.

LibreOffice Calc Logo.

Macros are used for a wide range of purposes, including:

Automating Tasks: Macros can perform sequences of actions, such as formatting, calculations, and data manipulation, in one go.

Customizing Functions: They enable users to create custom functions that may not be available through standard menu options.

Data Cleaning and Analysis: Macros can be used to clean and analyze large datasets quickly and efficiently.

Creating Interactive Reports: They can be employed to generate dynamic reports that update based on changing data.

Enhancing Productivity: Macros streamline workflows, allowing users to focus on higher-level tasks.

How to create a macro in LibreOffice Calc:

Step 1: Click on Tools > Macros > Record Macro.

Start with Data menu.

Step 2: Enter a name for the macro and click on Start Recording.

Write Macro name.

Step 3: Perform the actions that you want to automate.

Step 4: Click on Tools > Macros > Stop Recording to save the macro.

How to run a macro in LibreOffice Calc:

Click on Tools > Macros > Run Macro and select the macro that you want to run.

Run Macro you want to run.

Macros can be a very powerful tool for automating tasks in LibreOffice Calc. However, it is important to note that macros can also be used to spread malware. Therefore, it is important to only run macros from trusted sources.

Part 2: Steps to Write your first macro in LibreOffice Calc

Here is step-by-step tutorial on how to write a macro in LibreOffice Calc:

Step 1: Adding a Macro

Click on Tools > Macros > Organize Macros.

Organize Macros.

In the Macros dialog box, click on the New button.

Enter a name for the macro and click on OK.

The macro editor will open.

Step 2: Recording a Macro

Click on the Record button.

Perform the actions that you want to automate.

Click on the Stop Recording button to save the macro.

Step 3: Running a Macro

Click on Tools > Macros > Run Macro.

In the Macros dialog box, select the macro that you want to run and click on Run.

You can use macros to automate a wide range of tasks in LibreOffice Calc. For example, you can use macros to:

Format spreadsheets

  • Enter data

  • Create charts

  • Perform calculations

  • Generate reports

Macros can be a very powerful tool for saving time and improving efficiency.

Part 3: Creating shortcuts of macros in LibreOffice Calc

To create a keyboard shortcut for a macro in LibreOffice Calc, follow these steps:

Step 1: Open the Macro dialog box by clicking Tools > Macros > Organize Macros.

Select Organize Macros.

Step 2: Select the macro that you want to create a shortcut for and click the Modify button.

Step 3: In the Macro Properties dialog box, click the Shortcut Keys tab.

Step 4: In the Shortcut Keys section, press the keyboard shortcut that you want to assign to the macro.

Step 5: Click the Assign button.

Step 6: Click the OK button to close the Macro Properties dialog box.

Step 7: Click the Close button to close the Macro dialog box.

The keyboard shortcut will now be assigned to the macro and you can use it to run the macro. Be careful not to assign keyboard shortcuts that are already assigned to other functions in LibreOffice.

Tip: You can also create macros and assign keyboard shortcuts to them using the LibreOffice Basic IDE. This is a more advanced way to create macros, but it gives you more control over the macro code.

Part 4: Best Excellent Alternative to LibreOffice Calc - WPS Spreadsheet

WPS Office logo.

WPS Spreadsheet is a free and open-source spreadsheet application that is compatible with Microsoft Excel, Google Sheets, LibreOffice Calc, and OpenOffice Calc. It is available for Windows, macOS, Linux, Android, and iOS devices.

WPS Office features.

WPS Spreadsheet offers a wide range of features, including a powerful formula engine, charting tools, pivot tables and slicers, conditional formatting, and collaboration tools.

WPS Spreadsheet is a good choice for a wide range of users, including students, home users, and businesses of all sizes.

How to enable macros in WPS Spreadsheet

To enable macros in WPS Spreadsheet, follow these steps:

Step 1: Open WPS Spreadsheet.

Step 2: Click on the File tab and select Options.

Step 3: In the Options dialog box, click on the Trust Center tab.

select trust center.

Step 4: Click on the Trust Center Settings button.

Step 5: In the Trust Center dialog box, click on the Macro Settings tab.

Step 6: Select the Enable all macros (not recommended; potentially dangerous code can run) option.

Step 7: Click on the OK button to close the Trust Center dialog box.

Step 8: Click on the OK button to close the Options dialog box.

Note: Enabling macros can pose a security risk, so it is important to only enable macros from trusted sources.

How to Download WPS Office:

Step 1: Head to the official Free Download WPS Office for PC/ Windows/ Mac | Download Latest Version

Download WPS Office.

Step 2: Choose your preferred package (Windows or Mac).

Step 3: Follow the straightforward installation process with visual guidance:

a. Windows:

b. Windows (Alternative Guide):

Opt for WPS Office, the intelligent choice for a free, feature-rich alternative to Microsoft Office on both Windows and Mac platforms.

WPS Office- Free All-in-One Office Suite
  • Use Word, Excel, and PPT for FREE, No Ads.

  • Edit PDF files with the powerful PDF toolkit.

  • Microsoft-like interface. Easy to learn. 100% Compatibility.

  • Boost your productivity with WPS's abundant free Word, Excel, PPT, and CV templates.

5,820,008 User
Algirdas Jasaitis


Can anyone create LibreOffice Calc macros?

Yes, anyone with basic knowledge of LibreOffice Calc can create macros. The software offers a recording feature for simple tasks and a programming language, LibreOffice Basic, for more complex automation. While advanced skills may be required for complex tasks, even beginners can start creating macros with practice.

Where can I find more resources to learn about LibreOffice Calc macros? 

You can find resources to learn about LibreOffice Calc macros from official documentation, tutorials, forums, books, online courses, blogs, and the LibreOffice community. Some recommended sources include the official Calc Macros Guide, YouTube tutorials, and forums like LibreOffice Community Forums.


This guide introduces LibreOffice Calc macros, emphasizing their power in automating tasks. It covers creation, execution, and shortcuts. WPS Spreadsheet is recommended as a compatible alternative, known for its templates, lightweight design, collaboration features, and stability. Instructions for enabling macros in WPS Spreadsheet and downloading WPS Office are provided. The guide emphasizes safety when enabling macros and offers a resource list for further learning.

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.