Create and run a macro

Create and run a macro

What is a Macro?

Macros are sequences of actions that you want to automate. You can do this by creating a VBA macro or record a macro. 

Create a VBA macro

To create a macro:
  1. Click Tools > VBA Macros > Create. 
  2. The Create Macros menu is displayed.
  3. Name the macro that you wish to create. You can also describe the functioning of the macro.
  4. You can choose to either record the macro or write the code for macro using VBA editor.

Record a macro

To record a macro:
  1. Click Tools > VBA Macros > Record.
  2. Name the macro and continue recording. Note that the macro name can only consist of alphabets, numbers and underscore characters.
  3. Click on the box near Use Relative Reference if you want the cell referencing in the macro to be relative (A1, for instance) and not absolute* ($A$1 for instance).
  4. Make the changes that you wish to be recorded in the macro. 
  5. Click on Stop Recording *image* icon near the notification to stop the process. You can also edit the recorded macro using the VBA editor.

Absolute referencing - The cells are referenced $Column_Number$Cell_Number, meaning the macro is executed in the same cells used when recording the macro.
Relative referencing - The cells are referenced without the "$" constraint, meaning the macro is executed with cells relative from where the macro is executed.
You can choose if you need absolute or relative referencing from the popup indicating that the macro is being recorded too.

Run a macro in a sheet

To run a macro:
Click Tools > VBA Macros > Manage > Run the macro you want from the list of macros you've created for the sheet.
You can also assign a macro to a button and run the macro just by clicking the button.


Assign macros to a button

To assign macros to a button:
  1. Click the Advance Options on the top-right corner of the button or right click on the button.
  2. Select Assign an Existing Macro.
  3. In the macro list that appears, choose the desired macro and click "Assign".
  4. To create a new macro select Assign New Macro. You can write or record the macro.


Here are the supported events that you can use while coding your macro.

Workbook Events:

1. Open

2. New Sheet

Sheet Events:

1. Change

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now

            Get started with Zoho Sign

            in a few quick steps!

            Download Help Guide

                        Still can't find what you're looking for?

                        Write to us:



                          Zoho Marketing Automation

                            Zoho Sheet Resources


                                Zoho Forms Resources

                                  Secure your business
                                  communication with Zoho Mail

                                  Mail on the move with
                                  Zoho Mail mobile application

                                    Stay on top of your schedule
                                    at all times

                                    Carry your calendar with you
                                    Anytime, anywhere

                                          Zoho Sign Resources

                                            Sign, Paperless!

                                            Sign and send business documents on the go!

                                            Get Started Now

                                                Zoho SalesIQ Resources

                                                    Zoho TeamInbox Resources

                                                            Zoho DataPrep Resources

                                                              Zoho DataPrep Demo

                                                              Get a personalized demo or POC

                                                              REGISTER NOW

                                                                Design. Discuss. Deliver.

                                                                Create visually engaging stories with Zoho Show.

                                                                Get Started Now

                                                                                      • Related Articles

                                                                                      • Create a new blank spreadsheet

                                                                                        To create a new blank spreadsheet, open the app and follow these steps: In the listing page, tap the + icon in the bottom bar. Choose the Blank Spreadsheet option from the listed gallery.
                                                                                      • Create a named range

                                                                                        To create a named range: Select the desired cell range. Go to  Under the Insert menu, choose Define Name. You can choose to define a cell range, an expression, or a constant value. Enter the desired values and tap Done.
                                                                                      • Create spreadsheets from templates

                                                                                        To create a new spreadsheet from templates, open the app and follow these steps: In the listing page, tap the + icon in the bottom bar. Simply tap to open the desired template from the default template gallery. You can immediately start editing the ...
                                                                                      • How to create data validation?

                                                                                        Create a data validation for cells To create data validation: Click Data > Data Validation. You can choose the required range to apply data validation from the dialog shown below. The options that are available include the following: Decimal number, ...
                                                                                      • Create a form in Zoho Sheet

                                                                                        To create a form: Click Tools > Create Form. Enter the Form Title and Description in the Create Form window and click Create. A new sheet for the form results opens.  In the success notification that appears, select 'Click Here'. The form Builder ...
                                                                                      Wherever you are is as good as
                                                                                      your workplace



                                                                                        Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.


                                                                                        Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.


                                                                                        Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.

                                                                                        CRM Tips

                                                                                        Make the most of Zoho CRM with these useful tips.

                                                                                          Zoho Show Resources