What is macro in excel VBA?

  • A macro is a set of actions that you can run as many times as you want.
  • Theoretically, it is a set of code written in back end of Excel.
  • We can save macro and run as many times as you want and whenever you want.
  • Macros help you to save time on repetitive tasks involved in data manipulation and data reports that are required to be done frequently.
  • VBA Macros use the Visual Basic Application in Excel to create custom user-generated functions and speed up manual tasks by creating automated processes.
  • Macros are subroutines written in Visual Basic for Excel that can automate actions in a spreadsheet. They can either be coded directly in VBA by opening the Visual Basic window in Developer.

How to record macro?

  1. File —–> New and Save this file as . xlms (Marco enable format)
  2. Developer tab——–> Click On record macros
  3. Record macro dialog box will appear

Step 1.

  1. Name: – Daily_Record (Name of Macro)
  2. Store macros in —> Select this workbook
  3. Description—> Type some line about your macro like clear data. or coloring data
  4. Finally click on ok button
  5. Now types on excel sheet as you want to record content.
  6. Finally click on stop recording Marco.

Step 2

  1. Make a shape of any type
  2. Type name as you required
  3. Right click on shape and select assign macro
  4. Select macro you want to assign
  5. From macro in drop box select this work book
  6. Click on ok.

Step 3

  1. Now delete data form sheet (what you have recorded)
  2. And click on button you have created
  3. As you click it will added data what you have recorded even after deleting it.

Step 4

  1. Press Alt + F11 to open VBA Application File (Coding)
  2. Double click on macro to get code of program
  3. Click on first line of code (From module)
  4. Use F8 to check step by step compile of program

Same way creates another button like

  1. Cleardata
  2. colordata
Scroll to Top