SlideShare a Scribd company logo
1 of 19
Introduction to Microsoft Excel 2007 Macros
Contents Introduction to Macro Introduction to Visual Basic for Application Recording a Macro Looking at the code of Recorded Macro
Introduction to Visual Basic for Application Microsoft Excel 2007 in itself a tool which helps users to work with worksheets & workbooks with ease.   This tool is one of the ultimate timesaver, but there are numerous events when you have to do repetitive tasks which are of a very little value but consume your precious time; yet engage you in a less productive activity, which Excel may do automatically.   Microsoft Excel 2007 macro is the feature which eliminates or at-least minimize these events which take your precious time in repetitive tasks, and you will be able to capitalize this time in more productive & strategic activities.
Introduction to Visual Basic for Application - cont… Apart from automating repetitive tasks Microsoft Excel Macros may also be used to create user interfaces User interfaces are screens where user can give inputs with ease also it enables input validations
Introduction to Visual Basic for Application - cont… What is Visual Basic?Visual Basic is a language which is inherited from a very popular language BASIC. BASIC stands for Beginners All-purpose Symbolic Instruction Code. Visual Basic is called visual as you can do most of the program by click and go i.e. visually.  It’s an event driven & object based language. What is Event Driven Language?When we say event driven it means that you can write triggers which will initiate on specific events for example when user opens any document or saves any document What is Object Based Language?Object based language is language in which we can use objects & their properties i.e. we can use the Worksheet object and its property SheetName when some one clicks on a button
Introduction to Visual Basic for Application - cont… Visual Basic for ApplicationVisual Basic for Application is called VBA as it uses Visual Basic language and is capable of using application specific objects i.e. if we talk about VBA for Excel it can use Cell Object, Range Object, Worksheet Object, Workbook Object etc.
Recording your first Macro Microsoft Excel 2007 provides you a very helpful option which enables you to record a macro and also modify and run afterwards Microsoft Excel 2007 don’t provide you the macro recording option by default for enabling macro recording at first you need to enable the Developer Tab, next slide defines step by step procedure to enable Developer Tab
Enabling the Developer Tab Click on Office Button Click on Excel Options On Popular Tab checkShow Developer tab inRibbon
Enabling the Developer Tab Once you are done with the process you will have the Developer Tab ready
Recording your first Macro When you record macro Microsoft Excel 2007 provides you with 2 options either you can record a macro using Absolute References or Relative References If you go for Absolute References Excel’s behavior will be: You record a macro in Cell A1 type “Excel is Great” format Bold Cell B1 Whenever you play / run this macro Excel will always type “Excel is Great” in Cell A1 and format Bold Cell B1 no matter wherever your cursor is
Recording your first Macro You can refer to following tab that you can click on Use Relative References which will enable you to record a macro in relative cells, as discussed whenever a relative reference macro is executed it will run in-place
Recording your first Macro Click Developer Tab Click on Use Relative Reference Click on Record Macro 1 3 2
Recording your first Macro As soon as you press record macro button the following screen will appear In the Macro name boxyou have to type the nameof macro In Shortcut key you can typeshort cut key which invokethe Macro Store macro (will discussedlater) You can also provide description of the macro
Recording your first Macro As soon as you press OK in the previous dialog box two things happens first record macro button changesto Stop Recording Secondly Excel starts lookingfor your action and will recordthe same Please follow steps on the following slide to complete recording
Recording your first Macro Click on Cell A1 type “Excel is Great” Select cells from A1:C1 click on Home Tab and click on Merge & Center  Press Bold & Italics Now click on Developer Tab and click on Stop recording
Playing your Macro You can execute the macro you just recorded by either clicking on the Macro button on the Developer Tab or by pressing Alt F8 , you can see the list of Recorded macros in the dialog box you can press Run buttonto execute the macro as soonas you press run you can seethat your recorded macro willexecute
Behind the scenes To see what Excel did behind the scenes you can either click on Macros button on Developer Tab and select Edit or you can press Alt F11
What it looks like This is what Excel did behind the scenes, it written the code for you.  You can change the code if you want.  You can either closethe window or pressAlt F11 again to goback to your Excelnormal screen
Conclusion Macros are used to automate tasks or you can use macros to develop user interfaces Excel Macro use a language called VBA (Visual Basic for Applications), which is both Event Driven and Object Based The easiest way to look at macro is by using the Excel’s record Macro Feature You can even edit Excel’s recorded macro by yourself Soon we will publish a presentation which will guide you on how to write your own macro Please visit www.exceladvise.com For more on Excel Functions Please comment if you like it, or have any suggestions. 19 Photo Courtesy – www.freedigitalphotos.net

More Related Content

What's hot (20)

Ms access
Ms access Ms access
Ms access
 
An introduction to vba and macros
An introduction to vba and macrosAn introduction to vba and macros
An introduction to vba and macros
 
Ms access
Ms accessMs access
Ms access
 
Excel-VBA
Excel-VBAExcel-VBA
Excel-VBA
 
Ms excel
Ms excelMs excel
Ms excel
 
Lesson 1 Excel Introduction
Lesson 1 Excel IntroductionLesson 1 Excel Introduction
Lesson 1 Excel Introduction
 
Ms access
Ms accessMs access
Ms access
 
Vba part 1
Vba part 1Vba part 1
Vba part 1
 
Microsoft Excel - Macros
Microsoft Excel - MacrosMicrosoft Excel - Macros
Microsoft Excel - Macros
 
Excel
Excel Excel
Excel
 
Introduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 TutorialIntroduction to Excel - Excel 2013 Tutorial
Introduction to Excel - Excel 2013 Tutorial
 
Ms excel
Ms excelMs excel
Ms excel
 
Entering Data - Excel 2013 Tutorial
Entering Data - Excel 2013 TutorialEntering Data - Excel 2013 Tutorial
Entering Data - Excel 2013 Tutorial
 
Microsoft Excel Basics
Microsoft Excel BasicsMicrosoft Excel Basics
Microsoft Excel Basics
 
Microsoft Excel
Microsoft ExcelMicrosoft Excel
Microsoft Excel
 
Libre Office Writer Lesson 4: Working with tables and templates
Libre Office Writer Lesson 4: Working with tables and templatesLibre Office Writer Lesson 4: Working with tables and templates
Libre Office Writer Lesson 4: Working with tables and templates
 
VBA - Macro For Ms.Excel
VBA - Macro For Ms.ExcelVBA - Macro For Ms.Excel
VBA - Macro For Ms.Excel
 
A Quick Simple MS Excel Macro
A Quick Simple MS Excel MacroA Quick Simple MS Excel Macro
A Quick Simple MS Excel Macro
 
Using macros in microsoft excel part 1
Using macros in microsoft excel   part 1Using macros in microsoft excel   part 1
Using macros in microsoft excel part 1
 
Excel functions formulas
Excel functions formulasExcel functions formulas
Excel functions formulas
 

Similar to Introduction To Excel 2007 Macros

Intro macros in Excel 2007
Intro macros in Excel 2007Intro macros in Excel 2007
Intro macros in Excel 2007Hasrudin Tazep
 
E learning excel vba programming lesson 1
E learning excel vba programming  lesson 1E learning excel vba programming  lesson 1
E learning excel vba programming lesson 1Vijay Perepa
 
Apress.migrating.to.windows.phone.dec.2011
Apress.migrating.to.windows.phone.dec.2011Apress.migrating.to.windows.phone.dec.2011
Apress.migrating.to.windows.phone.dec.2011gautamkumar048
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1rupeshkanu
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vbarjg_vijay
 
Creating reports in oracle e business suite using xml publisher
Creating reports in oracle e business suite using xml publisherCreating reports in oracle e business suite using xml publisher
Creating reports in oracle e business suite using xml publisherSamchi Fouzee
 
Top 20 Tips for Office 365 Productivity
Top 20 Tips for Office 365 ProductivityTop 20 Tips for Office 365 Productivity
Top 20 Tips for Office 365 ProductivityChristian Buckley
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editorputiadetiara
 
0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdfABHISHEK MALIK
 
Lab jam websphere message broker labs
Lab jam   websphere message broker labsLab jam   websphere message broker labs
Lab jam websphere message broker labsEng Binary
 

Similar to Introduction To Excel 2007 Macros (20)

Intro macros in Excel 2007
Intro macros in Excel 2007Intro macros in Excel 2007
Intro macros in Excel 2007
 
VBA
VBAVBA
VBA
 
E learning excel vba programming lesson 1
E learning excel vba programming  lesson 1E learning excel vba programming  lesson 1
E learning excel vba programming lesson 1
 
Excel 2007 Unit I
Excel 2007 Unit IExcel 2007 Unit I
Excel 2007 Unit I
 
Excel vba
Excel vbaExcel vba
Excel vba
 
Vbabook ed2
Vbabook ed2Vbabook ed2
Vbabook ed2
 
Apress.migrating.to.windows.phone.dec.2011
Apress.migrating.to.windows.phone.dec.2011Apress.migrating.to.windows.phone.dec.2011
Apress.migrating.to.windows.phone.dec.2011
 
Notacd04
Notacd04Notacd04
Notacd04
 
Notacd04
Notacd04Notacd04
Notacd04
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vba
 
Vba 2 (students copy)
Vba 2 (students copy)Vba 2 (students copy)
Vba 2 (students copy)
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Creating reports in oracle e business suite using xml publisher
Creating reports in oracle e business suite using xml publisherCreating reports in oracle e business suite using xml publisher
Creating reports in oracle e business suite using xml publisher
 
Excel chapter-7
Excel chapter-7Excel chapter-7
Excel chapter-7
 
Top 20 Tips for Office 365 Productivity
Top 20 Tips for Office 365 ProductivityTop 20 Tips for Office 365 Productivity
Top 20 Tips for Office 365 Productivity
 
UNIT I.pptx
UNIT I.pptxUNIT I.pptx
UNIT I.pptx
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editor
 
0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf0403-excel-macros-made-easy.pdf
0403-excel-macros-made-easy.pdf
 
Lab jam websphere message broker labs
Lab jam   websphere message broker labsLab jam   websphere message broker labs
Lab jam websphere message broker labs
 

More from Excel

Causes of Financial Model Errors
Causes of Financial Model ErrorsCauses of Financial Model Errors
Causes of Financial Model ErrorsExcel
 
Spreadsheet risks & mitigation
Spreadsheet risks & mitigationSpreadsheet risks & mitigation
Spreadsheet risks & mitigationExcel
 
Top 12 gestures if a person is lying
Top 12 gestures if a person is lyingTop 12 gestures if a person is lying
Top 12 gestures if a person is lyingExcel
 
Microsoft Excel 2007, things you should KNOW
Microsoft Excel 2007, things you should KNOWMicrosoft Excel 2007, things you should KNOW
Microsoft Excel 2007, things you should KNOWExcel
 
Excel DAYS360 Function
Excel DAYS360 FunctionExcel DAYS360 Function
Excel DAYS360 FunctionExcel
 
Microsoft Excel 2010 Sparklines
Microsoft Excel 2010 SparklinesMicrosoft Excel 2010 Sparklines
Microsoft Excel 2010 SparklinesExcel
 
Excel SUMIFS Function
Excel SUMIFS FunctionExcel SUMIFS Function
Excel SUMIFS FunctionExcel
 
Using Multiple Workbooks & Consolidation in Microsoft Excel
Using Multiple Workbooks & Consolidation in Microsoft ExcelUsing Multiple Workbooks & Consolidation in Microsoft Excel
Using Multiple Workbooks & Consolidation in Microsoft ExcelExcel
 
Excel DATEDIFF Function
Excel DATEDIFF FunctionExcel DATEDIFF Function
Excel DATEDIFF FunctionExcel
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionExcel
 

More from Excel (10)

Causes of Financial Model Errors
Causes of Financial Model ErrorsCauses of Financial Model Errors
Causes of Financial Model Errors
 
Spreadsheet risks & mitigation
Spreadsheet risks & mitigationSpreadsheet risks & mitigation
Spreadsheet risks & mitigation
 
Top 12 gestures if a person is lying
Top 12 gestures if a person is lyingTop 12 gestures if a person is lying
Top 12 gestures if a person is lying
 
Microsoft Excel 2007, things you should KNOW
Microsoft Excel 2007, things you should KNOWMicrosoft Excel 2007, things you should KNOW
Microsoft Excel 2007, things you should KNOW
 
Excel DAYS360 Function
Excel DAYS360 FunctionExcel DAYS360 Function
Excel DAYS360 Function
 
Microsoft Excel 2010 Sparklines
Microsoft Excel 2010 SparklinesMicrosoft Excel 2010 Sparklines
Microsoft Excel 2010 Sparklines
 
Excel SUMIFS Function
Excel SUMIFS FunctionExcel SUMIFS Function
Excel SUMIFS Function
 
Using Multiple Workbooks & Consolidation in Microsoft Excel
Using Multiple Workbooks & Consolidation in Microsoft ExcelUsing Multiple Workbooks & Consolidation in Microsoft Excel
Using Multiple Workbooks & Consolidation in Microsoft Excel
 
Excel DATEDIFF Function
Excel DATEDIFF FunctionExcel DATEDIFF Function
Excel DATEDIFF Function
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP Function
 

Recently uploaded

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceIES VE
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 

Recently uploaded (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 

Introduction To Excel 2007 Macros

  • 1. Introduction to Microsoft Excel 2007 Macros
  • 2. Contents Introduction to Macro Introduction to Visual Basic for Application Recording a Macro Looking at the code of Recorded Macro
  • 3. Introduction to Visual Basic for Application Microsoft Excel 2007 in itself a tool which helps users to work with worksheets & workbooks with ease. This tool is one of the ultimate timesaver, but there are numerous events when you have to do repetitive tasks which are of a very little value but consume your precious time; yet engage you in a less productive activity, which Excel may do automatically. Microsoft Excel 2007 macro is the feature which eliminates or at-least minimize these events which take your precious time in repetitive tasks, and you will be able to capitalize this time in more productive & strategic activities.
  • 4. Introduction to Visual Basic for Application - cont… Apart from automating repetitive tasks Microsoft Excel Macros may also be used to create user interfaces User interfaces are screens where user can give inputs with ease also it enables input validations
  • 5. Introduction to Visual Basic for Application - cont… What is Visual Basic?Visual Basic is a language which is inherited from a very popular language BASIC. BASIC stands for Beginners All-purpose Symbolic Instruction Code. Visual Basic is called visual as you can do most of the program by click and go i.e. visually. It’s an event driven & object based language. What is Event Driven Language?When we say event driven it means that you can write triggers which will initiate on specific events for example when user opens any document or saves any document What is Object Based Language?Object based language is language in which we can use objects & their properties i.e. we can use the Worksheet object and its property SheetName when some one clicks on a button
  • 6. Introduction to Visual Basic for Application - cont… Visual Basic for ApplicationVisual Basic for Application is called VBA as it uses Visual Basic language and is capable of using application specific objects i.e. if we talk about VBA for Excel it can use Cell Object, Range Object, Worksheet Object, Workbook Object etc.
  • 7. Recording your first Macro Microsoft Excel 2007 provides you a very helpful option which enables you to record a macro and also modify and run afterwards Microsoft Excel 2007 don’t provide you the macro recording option by default for enabling macro recording at first you need to enable the Developer Tab, next slide defines step by step procedure to enable Developer Tab
  • 8. Enabling the Developer Tab Click on Office Button Click on Excel Options On Popular Tab checkShow Developer tab inRibbon
  • 9. Enabling the Developer Tab Once you are done with the process you will have the Developer Tab ready
  • 10. Recording your first Macro When you record macro Microsoft Excel 2007 provides you with 2 options either you can record a macro using Absolute References or Relative References If you go for Absolute References Excel’s behavior will be: You record a macro in Cell A1 type “Excel is Great” format Bold Cell B1 Whenever you play / run this macro Excel will always type “Excel is Great” in Cell A1 and format Bold Cell B1 no matter wherever your cursor is
  • 11. Recording your first Macro You can refer to following tab that you can click on Use Relative References which will enable you to record a macro in relative cells, as discussed whenever a relative reference macro is executed it will run in-place
  • 12. Recording your first Macro Click Developer Tab Click on Use Relative Reference Click on Record Macro 1 3 2
  • 13. Recording your first Macro As soon as you press record macro button the following screen will appear In the Macro name boxyou have to type the nameof macro In Shortcut key you can typeshort cut key which invokethe Macro Store macro (will discussedlater) You can also provide description of the macro
  • 14. Recording your first Macro As soon as you press OK in the previous dialog box two things happens first record macro button changesto Stop Recording Secondly Excel starts lookingfor your action and will recordthe same Please follow steps on the following slide to complete recording
  • 15. Recording your first Macro Click on Cell A1 type “Excel is Great” Select cells from A1:C1 click on Home Tab and click on Merge & Center Press Bold & Italics Now click on Developer Tab and click on Stop recording
  • 16. Playing your Macro You can execute the macro you just recorded by either clicking on the Macro button on the Developer Tab or by pressing Alt F8 , you can see the list of Recorded macros in the dialog box you can press Run buttonto execute the macro as soonas you press run you can seethat your recorded macro willexecute
  • 17. Behind the scenes To see what Excel did behind the scenes you can either click on Macros button on Developer Tab and select Edit or you can press Alt F11
  • 18. What it looks like This is what Excel did behind the scenes, it written the code for you. You can change the code if you want. You can either closethe window or pressAlt F11 again to goback to your Excelnormal screen
  • 19. Conclusion Macros are used to automate tasks or you can use macros to develop user interfaces Excel Macro use a language called VBA (Visual Basic for Applications), which is both Event Driven and Object Based The easiest way to look at macro is by using the Excel’s record Macro Feature You can even edit Excel’s recorded macro by yourself Soon we will publish a presentation which will guide you on how to write your own macro Please visit www.exceladvise.com For more on Excel Functions Please comment if you like it, or have any suggestions. 19 Photo Courtesy – www.freedigitalphotos.net