Instructions on how to create and use macros in Excel Create macros, save macros, run macros

Beginners learn about macros in Excel, creating a simple macro will make it easier for you to understand and from there you will learn more advanced with macros in Excel. If you want to know how to create, save and run macros in Excel, please refer to the example of creating a simple macro that the article below shares.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 1

Below the article guides you how to create and use macros, save macros in Excel, invite you to follow along.

First, if your Excel file does not display the Developer tab, then display the Developer tab on the Ribbon as follows:

1. Select File -> Options.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 2

2. In the Excel Options window, select Customize Ribbons , then check the box in the box before Developer and click OK .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 3

Method 1: Create a Macro using the Record Macro

Step 1 : In Excel file, select the cell to perform the operations, next select Developer -> Record Macro .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 4

Step 2: Appears a Record Macro table, enter the name of your macro in the Macro name (write without spaces), you can also describe your macro in the Description section . You can also set shortcuts in the Shortcut key box . Then click OK to start recording operations in Excel.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 5

Step 3: You start to perform the operations you want to create macros, for example, you perform some alignment operations such as center alignment, bold printing, coloring, and background shading for text.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 6

Step 4: After you finish manipulating and want to stop recording macros, you select the Developer tab -> Stop Recording.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 7

So you've created the simple Macro already, if you want to create other macros, then you do the same.

Step 5: Use the created macro.

Select a cell in Excel where you need to use macros, then select the Developer -> Macros tab .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 8

The Macro dialog box appears, select the macro name you want to use and select Run to run the macro.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 9

So immediately the data box you choose will be performing the manipulation of macros that you manipulated during macro creation.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 10

Method 2: Create Macros using Visual Basic code

Step 1: Select Developer -> Macros or press Alt + F8.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 11

Step 2 : The Macro dialog box appears , enter a name for the macro in the Macro name section (write immediately, without accents) and click Create .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 12

Step 3 : In Sub sub tenmacro () . End Sub you write Visual Basic code, if you do not know the code you can search for suitable code online, then copy and paste the code into the middle of the section Sub . End This sub . Then close the Visual Basic window.

For example, there is a simple code below to help you italicize and fill in a red background.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 13

Step 4: Use the Macro

You can use macros similar to the way above is to select the cell to run the Macro and click Developer -> Macros tab .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 14

The Macro dialog box appears, select the macro name to use and select Run .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 15

So the macro will run and execute exactly the code that Visual Basic you enter.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 16

Step 5: Set up keyboard shortcuts to use macros.

If at the time of creating macros, but you have not set a shortcut, you can set the shortcut again by in the Macro dialog box, select the macro name to set the shortcut and select Options .

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 17

Macro Options appears , enter the characters in the white box next to Ctrl and click OK to save the shortcut.

Note: you must not enter the numeric keys but only the characters.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 18

So instead of having to choose Macros -> Macro name -> Run , you can use the shortcut you just set to use macros.

Step 6: Save the Macro

Select File -> Save As ( F12 key ). The Save As window appears, select a location to save the file, name the file, then in the Save as type section, select Excel Macro-Enabled Workbook and select Save to save the Excel file and macro.

Instructions on how to create and use macros in Excel Create macros, save macros, run macros Picture 19

So you know how to create and use macros in Excel and how to save macros in Excel. To know how to turn on, turn off, delete macros in Excel, you can refer to the article How to turn on, turn off, delete macros in Excel.

If you know how to use macros proficiently, you will work with Excel faster, greatly reducing Excel processing time. Good luck!

3.5 ★ | 2 Vote

May be interested

  • Delete background colors and backgrounds in ExcelPhoto of Delete background colors and backgrounds in Excel
    delete background colors and backgrounds in excel. in excel, you can use images as the background for a spreadsheet for the purpose of displaying only, since it is not printed. but if you use background color, it will be printed with data in exc worksheet
  • How to delete notes, comments in ExcelPhoto of How to delete notes, comments in Excel
    how to delete notes, comments in excel. comments in excel help you annotate for a data cell or all worksheets, making the document easier to understand even when others use it. but when you don't need the notes, you can delete them
  • How to delete all formulas in Excel fastestPhoto of How to delete all formulas in Excel fastest
    how to delete all formulas in excel fastest. how can you delete all formulas and keep the resulting values, or delete all formulas and result values? please refer to the following article.
  • Set a password for Word, Excel, PowerPoint documents in Office 2016Photo of Set a password for Word, Excel, PowerPoint documents in Office 2016
    set a password for word, excel, powerpoint documents in office 2016. sometimes due to the nature of the work or in the direction of the partner, you must take security measures for your document to avoid typing cases. document theft discloses information
  • Top 3 best software to reduce Excel file size 2020Photo of Top 3 best software to reduce Excel file size 2020
    when sending emails usually only send us a file with a limited capacity, so compressing the excel file is necessary in these cases. so, to compress excel file, which software do we have to use to get the best compression result?
  • Top 3 best PDF file reduction software 2020Photo of Top 3 best PDF file reduction software 2020
    top 3 software to reduce the size of the best pdf files 2020. with the large pdf files will be difficult when they send via mail or upload online. the reduction of data file size not only helps you reduce the file size convenient for uploading and sharing