TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Excel

    Create a Macro Function in MS Excel

    Overview

    In this tutorial, we will learn the steps involved to Create a Macro Function in an MS Excel document. Macros are disabled by default due to security reasons. We need to save the Excel Workbook with macros in it with the Macro-enables Save option.

    Create a Macro Function

    Open Start Menu and click the Excel application icon.

    Excel Start Menu Entry

    Open an Excel Document. Click the Blank workbook option.

    This will open a new blank Excel workbook.

     

    Windows Excel Blank Sheet

     

    Click on the Developer tab. ->> Macros button in the Developer ribbon menu.

    In case, if the Developer tab is not present in the menu. Follow the steps outlined here:

    https://www.testingdocs.com/customize-the-ribbon-in-ms-excel/

    We can find the Macros button in the Developer ribbon.

     

    Macros Excel Document

     

    Enter the Macro name. Click on the Create button to create the macro.

    Choose the scope of the Macro:

    • All Open Workbooks
    • This Workbook

    We will create a macro function to print “Hello World”. The macro name is MyFirstMacro()

    Add the following simple macro code:

    Function MyFirstMacro()
    MyFirstMacro = "Hello World"
    End Function

     

    Macro Code in Excel

    Invoke the Macro

    In the Excel sheet, Choose a cell to call the macro function. Start typing the function name.

     

    Invoke Macro Function Excel

     

    Excel would prompt with the function. Select it.

    =MyFirstMacro()

     

    Macro Output Excel Sheet

     

    That’s it. A successful macro would print the Hello World message in the excel sheet cell.

    Related Posts

    MS Excel Workbook

    Excel /

    MS Excel Features

    Line chart Excel

    Excel /

    How to Create Line Charts using Excel

    ‹ How to Create Line Charts using Excel› MS Excel Features

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com