SlideShare a Scribd company logo
1 of 32
What is an Excel Macro?
• A macro is a set of instructions that tells Excel
to perform one or more actions
• An Excel macro is like a computer program but
it runs completely within Excel.
• Used to automate tedious or frequently
repeated tasks
– Macro can carry out sequence of actions much
more quickly
1
2
Macro Advantages
• Save time – even if you are an expert Excel
user, the computer can beat you every time
• Reduce errors – if the instructions are correct,
programs do not make mistakes
• Enforce standards – for example, each sales
rep may be required to submit a weekly
summary spreadsheet that follows a specific
structure and format
3
4
Macros
• Two ways to create a macro:
– Record it using the Macro Recorder
– Build by typing instructions in a VBA (Visual Basic
for Applications) module (beyond the scope of this
course)
– These two approaches can be combined
5
Macro Security
• Macro code can be used for evil too
• VBA macros included in Microsoft Office
documents (usually attached in emails) have
contained viruses in the past
– macro programs embedded in documents can be run
automatically when the document is opened, a
mechanism which can spread viruses.
• To configure security settings:
– File  Options  Excel Options  Trust Center
Trust Center Settings
6
Macro Viruses
• One famous macro virus called Melissa, released
in March, 1999:
– The virus sent a file called “List.doc” which it claimed
had passwords to 80 adult websites.
– Anyone who opened the document would get a free
copy of the Melissa macro virus.
– Melissa would then gather the first fifty entries in the
address book, and email itself to all of them.
– Melissa infected so many systems that by March 26th,
it was shutting down mail servers with all of the
infected emails traveling across the net.
7
Adding the Developer Tab
• Click on the File tab of the ribbon to open the File menu
• Click on Options to open the Excel Options dialog box.
• Click on the Customize Ribbon option in the left hand
window
• Under the Main Tabs section of the options window,
check off the Developer option.
• Click OK the Developer tab should now be visible
8
Enabling the developer tab
9
Adding the Macro button in excel
ribbon
• Go to the “File” tab.
10
Click the “More…” option from the list
→ select the “Options”.
11
• The “Excel Options” window pops up.
• ৹ First, click the “Quick Access Toolbar” on the
left side of the “Excel Options” window.
• ৹ Next, select the “Macros” option from the
“Choose commands from:” drop-down.
12
13
Workbook Formats
• The Excel default workbook format (.xlsx) does
not support macros
• To save a workbook containing macros, you
need to use one of the following formats:
– .xlsm
– .xlsb
– .xls
14
The Macro Recorder
• The recorder allows you to create macros
without knowing VBA
• Best to plan your macro before starting the
recorder
• If you’re curious about VBA and want to learn
to do more with macros, the recorder can be a
great learning tool
– You can examine the code that the recorder
generates and edit it.
15
The Macro Recorder dialog box
• 4 options to complete in this dialog box:
– Macro name - give your macro a descriptive
name. The name must begin with a letter and
have no spaces. Only letters, numbers and
underscore permitted.
– Shortcut key - (optional) fill in a letter, number,
or other character in the available space. This
will allow you to run the macro by holding down
the CTRL key and pressing the chosen letter on
the keyboard.
– Store macro in:
• This workbook: the macro is available only in this
file.
• New workbook: this option opens a new Excel file
and the macro is only available in the new file.
• Personal macro workbook: this creates a hidden file
Personal.xls which stores your macros and makes
them available in all Excel files
– Description: (optional) enter a description of
the macro
16
17
Saving a Macro
1. Click No.
2.
2. In the Save As box, in the Save as type list
box, choose Excel Macro-Enabled Workbook.
3. Click save .
18
19
Macro Example
• Create a macro that automates the formatting
for a heading for the Atlantic Music Company:
20
Editing/Step Into a Macro
• An Excel macro is written in the Visual Basic
for Applications (VBA) programming language.
• Clicking on either the Edit or Step Into buttons
in the Macro dialog box starts the VBA editor
• Using the VBA editor and covering the VBA
programming language is beyond the scope of
this class.
21
Recording with Relative References
• By default a macro is recorded with absolute
references.
– If you are in Cell A1 when you record a macro, the
action will play back in A1
• To record with relative references,
click Use Relative References
• Now the macro plays
back in the selected cell.
22
Macro Example
• Let’s create a macro that automates the
format for a monthly sales summary:
23
Replacing the sign
1. Click on record macro > name the macro
‘replace dot’ >assign a short cut command.
2. Press ctrl +H ( Find and Replace) > Enter ‘.’ In
the ‘find’ and ‘*’ in the ‘replace ‘ option.
3. In the end ,click on the stop recording button
on developer tab to stop the macro
recording.
24
25
How to insert a checkbox in Excel
• Go to Developer Tab - Controls - Insert -
 Form Controls - Check Box
26
• Click in the cell where you want to insert the
first checkbox.
• Position the checkbox by dragging it. To
remove the text “Check Box 1”, right-click the
check box, select Edit Text in the context
menu, and then delete the text.
27
• Checkbox is ready.
Drag the checkbox cells to all the below cells to
copy them.
28
Link a checkbox to cell
• To capture the status (checked or unchecked)
of a checkbox, you need to link the checkbox
to a particular cell. To do this, execute these
steps:
• Right-click on the checkbox and select Format
Control.
• In the Format Control dialog box, make the
following changes, and click OK.
• Value: Checked. This makes sure that the
checkbox is checked by default when you open
the workbook. 29
• Cell Link: $H$4. This is the cell linked to the
checkbox. You can also enter it manually or
select the cell to get the reference.
30
• Now your checkbox is linked to the cell. In the
linked cells, TRUE appears for selected
checkboxes and FALSE for cleared checkboxes.
31
32

More Related Content

Similar to ExcelMacros.pptx

Similar to ExcelMacros.pptx (20)

Microsoft Excel Tutorial
Microsoft Excel TutorialMicrosoft Excel Tutorial
Microsoft Excel Tutorial
 
Form4 cd4
Form4 cd4Form4 cd4
Form4 cd4
 
Microsoft Excel
Microsoft ExcelMicrosoft Excel
Microsoft Excel
 
Notacd04
Notacd04Notacd04
Notacd04
 
Notacd04
Notacd04Notacd04
Notacd04
 
Learn Excel Macro
Learn Excel Macro  Learn Excel Macro
Learn Excel Macro
 
Excel 2013
Excel 2013Excel 2013
Excel 2013
 
Adv excel® 2013
Adv excel® 2013Adv excel® 2013
Adv excel® 2013
 
Excel® 2013
Excel® 2013Excel® 2013
Excel® 2013
 
Microsoft Excel Basics
Microsoft Excel BasicsMicrosoft Excel Basics
Microsoft Excel Basics
 
Week 4 Lesson 2 - Getting Started with Excel.pptx
Week 4 Lesson 2 - Getting Started with Excel.pptxWeek 4 Lesson 2 - Getting Started with Excel.pptx
Week 4 Lesson 2 - Getting Started with Excel.pptx
 
Element of an electronic speadsheet ms excel
Element of an electronic speadsheet   ms excelElement of an electronic speadsheet   ms excel
Element of an electronic speadsheet ms excel
 
Installing and Using Productivity Shortcuts
Installing and Using Productivity ShortcutsInstalling and Using Productivity Shortcuts
Installing and Using Productivity Shortcuts
 
Learn Vba excel 2007
Learn Vba excel 2007Learn Vba excel 2007
Learn Vba excel 2007
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1
 
Chapter.10
Chapter.10Chapter.10
Chapter.10
 
easy EXCEL use
easy EXCEL useeasy EXCEL use
easy EXCEL use
 
Getting Started with Excel Macros – Day #1
Getting Started with Excel Macros – Day #1Getting Started with Excel Macros – Day #1
Getting Started with Excel Macros – Day #1
 
Excel vba
Excel vbaExcel vba
Excel vba
 
Online Advance Excel & VBA Training in India
 Online Advance Excel & VBA Training in India Online Advance Excel & VBA Training in India
Online Advance Excel & VBA Training in India
 

Recently uploaded

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixingviprabot1
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 

Recently uploaded (20)

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Effects of rheological properties on mixing
Effects of rheological properties on mixingEffects of rheological properties on mixing
Effects of rheological properties on mixing
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 

ExcelMacros.pptx

  • 1. What is an Excel Macro? • A macro is a set of instructions that tells Excel to perform one or more actions • An Excel macro is like a computer program but it runs completely within Excel. • Used to automate tedious or frequently repeated tasks – Macro can carry out sequence of actions much more quickly 1
  • 2. 2
  • 3. Macro Advantages • Save time – even if you are an expert Excel user, the computer can beat you every time • Reduce errors – if the instructions are correct, programs do not make mistakes • Enforce standards – for example, each sales rep may be required to submit a weekly summary spreadsheet that follows a specific structure and format 3
  • 4. 4
  • 5. Macros • Two ways to create a macro: – Record it using the Macro Recorder – Build by typing instructions in a VBA (Visual Basic for Applications) module (beyond the scope of this course) – These two approaches can be combined 5
  • 6. Macro Security • Macro code can be used for evil too • VBA macros included in Microsoft Office documents (usually attached in emails) have contained viruses in the past – macro programs embedded in documents can be run automatically when the document is opened, a mechanism which can spread viruses. • To configure security settings: – File  Options  Excel Options  Trust Center Trust Center Settings 6
  • 7. Macro Viruses • One famous macro virus called Melissa, released in March, 1999: – The virus sent a file called “List.doc” which it claimed had passwords to 80 adult websites. – Anyone who opened the document would get a free copy of the Melissa macro virus. – Melissa would then gather the first fifty entries in the address book, and email itself to all of them. – Melissa infected so many systems that by March 26th, it was shutting down mail servers with all of the infected emails traveling across the net. 7
  • 8. Adding the Developer Tab • Click on the File tab of the ribbon to open the File menu • Click on Options to open the Excel Options dialog box. • Click on the Customize Ribbon option in the left hand window • Under the Main Tabs section of the options window, check off the Developer option. • Click OK the Developer tab should now be visible 8
  • 10. Adding the Macro button in excel ribbon • Go to the “File” tab. 10
  • 11. Click the “More…” option from the list → select the “Options”. 11
  • 12. • The “Excel Options” window pops up. • ৹ First, click the “Quick Access Toolbar” on the left side of the “Excel Options” window. • ৹ Next, select the “Macros” option from the “Choose commands from:” drop-down. 12
  • 13. 13
  • 14. Workbook Formats • The Excel default workbook format (.xlsx) does not support macros • To save a workbook containing macros, you need to use one of the following formats: – .xlsm – .xlsb – .xls 14
  • 15. The Macro Recorder • The recorder allows you to create macros without knowing VBA • Best to plan your macro before starting the recorder • If you’re curious about VBA and want to learn to do more with macros, the recorder can be a great learning tool – You can examine the code that the recorder generates and edit it. 15
  • 16. The Macro Recorder dialog box • 4 options to complete in this dialog box: – Macro name - give your macro a descriptive name. The name must begin with a letter and have no spaces. Only letters, numbers and underscore permitted. – Shortcut key - (optional) fill in a letter, number, or other character in the available space. This will allow you to run the macro by holding down the CTRL key and pressing the chosen letter on the keyboard. – Store macro in: • This workbook: the macro is available only in this file. • New workbook: this option opens a new Excel file and the macro is only available in the new file. • Personal macro workbook: this creates a hidden file Personal.xls which stores your macros and makes them available in all Excel files – Description: (optional) enter a description of the macro 16
  • 17. 17
  • 18. Saving a Macro 1. Click No. 2. 2. In the Save As box, in the Save as type list box, choose Excel Macro-Enabled Workbook. 3. Click save . 18
  • 19. 19
  • 20. Macro Example • Create a macro that automates the formatting for a heading for the Atlantic Music Company: 20
  • 21. Editing/Step Into a Macro • An Excel macro is written in the Visual Basic for Applications (VBA) programming language. • Clicking on either the Edit or Step Into buttons in the Macro dialog box starts the VBA editor • Using the VBA editor and covering the VBA programming language is beyond the scope of this class. 21
  • 22. Recording with Relative References • By default a macro is recorded with absolute references. – If you are in Cell A1 when you record a macro, the action will play back in A1 • To record with relative references, click Use Relative References • Now the macro plays back in the selected cell. 22
  • 23. Macro Example • Let’s create a macro that automates the format for a monthly sales summary: 23
  • 24. Replacing the sign 1. Click on record macro > name the macro ‘replace dot’ >assign a short cut command. 2. Press ctrl +H ( Find and Replace) > Enter ‘.’ In the ‘find’ and ‘*’ in the ‘replace ‘ option. 3. In the end ,click on the stop recording button on developer tab to stop the macro recording. 24
  • 25. 25
  • 26. How to insert a checkbox in Excel • Go to Developer Tab - Controls - Insert -  Form Controls - Check Box 26
  • 27. • Click in the cell where you want to insert the first checkbox. • Position the checkbox by dragging it. To remove the text “Check Box 1”, right-click the check box, select Edit Text in the context menu, and then delete the text. 27
  • 28. • Checkbox is ready. Drag the checkbox cells to all the below cells to copy them. 28
  • 29. Link a checkbox to cell • To capture the status (checked or unchecked) of a checkbox, you need to link the checkbox to a particular cell. To do this, execute these steps: • Right-click on the checkbox and select Format Control. • In the Format Control dialog box, make the following changes, and click OK. • Value: Checked. This makes sure that the checkbox is checked by default when you open the workbook. 29
  • 30. • Cell Link: $H$4. This is the cell linked to the checkbox. You can also enter it manually or select the cell to get the reference. 30
  • 31. • Now your checkbox is linked to the cell. In the linked cells, TRUE appears for selected checkboxes and FALSE for cleared checkboxes. 31
  • 32. 32