Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
25 views9 pages

Automation Using Macros in Excel

The document explains the use of macros in Excel to automate repetitive tasks, highlighting the benefits of saving time and reducing errors. It covers the differences between absolute and relative macros, how to record and edit macros using VBA, and the creation of custom macros. Additionally, it discusses the use of form controls like spinner buttons and command buttons to enhance interactivity and automation in Excel tasks.

Uploaded by

priyanshu.24377
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

Automation Using Macros in Excel

The document explains the use of macros in Excel to automate repetitive tasks, highlighting the benefits of saving time and reducing errors. It covers the differences between absolute and relative macros, how to record and edit macros using VBA, and the creation of custom macros. Additionally, it discusses the use of form controls like spinner buttons and command buttons to enhance interactivity and automation in Excel tasks.

Uploaded by

priyanshu.24377
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Automation Using Macros in

Excel
Streamlining tasks with VBA, form controls, and custom macros

Priyanshu Jaiswal – 24377


Jatin Jain – 24344
Parth Goel – 24368
Akkshatt Shah – 24306
RS Sushant Shrivastav – 24474

preencoded.png
What Is a Macro?
Simple Definition Purpose & Benefits
A macro is a recorded or Automates repetitive tasks to
scripted set of Excel commands. to save time and reduce errors.
errors.

Use in Excel
Commonly used to automate formatting, calculations, and data entry.

preencoded.png
Absolute vs. Relative Macros

Feature Absolute Macro Relative Macro

Reference Type Fixed cell locations Relative to active cell


cell

Use Case Repeat exact Apply actions to


formatting or tasks varied cell positions

Example Format specific range Format current


A1:D10 selection's first 4
columns

preencoded.png
1. Click the Developer’s tab
How to Record a Macro
Start Recording
Go to Developer tab and click 'Record Macro'.

Perform Actions
4. Click OK Format cells or enter data as needed.

Stop Recording
Click 'Stop Recording' to save the macro.
2. Record Macro
3. Name your Macro Example
Macro that formats headers bold and sets column widths.

preencoded.png
Editing a Macro in VBA
Open VBA Editor
Use Alt + F11 or Developer tab to launch editor.

Locate Macro Code


Find macro in Modules folder in the Project window.

Edit Code
Modify simple VBA lines like font size or color.

preencoded.png
Writing Custom Macros
VBA scripting lets you write flexible, powerful macros from scratch.

Sub FormatReport()
Rows("1:1").Font.Bold = True
Columns("A:D").ColumnWidth = 15
Range("A2:D10").Interior.Color = RGB(220, 230, 241)
End Sub

This code bolds headers, sets column width, and colors cells.

preencoded.png
Form Controls in Excel
Spinner Button Command Button Access via Developer Tab
Increment or decrement numbers Triggers macros with a simple click.
numbers interactively. click. Insert and customize controls linked
linked to cells or macros.

preencoded.png
Spinner Button in Action
Insert Spinner
Go to Developer tab, choose Spinner from Form Controls.

Link to Cell
Set cell link for value to update dynamically.

Adjust Value
Use spinner arrows to increase or decrease quantity easily.

preencoded.png
Command Button with Macro
Macro
Insert Command Button
From Developer tab, add button to worksheet.

Assign Macro
Select macro that generates report or triggers task.

Click to Run
Simply click button to automate report generation.

Applications include dashboards, forms, and automated reports.

Remember: Always enable macros only from trusted sources.

preencoded.png

You might also like