Programming Excel Macros, Visual Basic, and Solving Your Problem.

Slides:



Advertisements
Similar presentations
Microsoft Excel 2002 Microsoft Excel is a powerful spreadsheet program that helps you to organize data complete calculations make decisions graph data.
Advertisements

Spreadsheet Basics Computer Technology.
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
Tutorial 8: Developing an Excel Application
XP New Perspectives on Microsoft Excel 2003, Second Edition- Tutorial 8 1 Microsoft Office Excel 2003 Tutorial 8 – Developing an Excel Application.
Microsoft Excel Computers Week 4.
Monday, February 9, 2009  Journal Activity:  Have you ever used Microsoft Excel and what do you think it is?  Agenda  Take Notes  Project 1 Steps.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Excel and VBA Creating an Excel Application
Microsoft Excel 2003 Illustrated Complete with Excel Programming.
Spreadsheets With Microsoft Excel ® as an example.
End Show Introduction to Electronic Spreadsheets Unit 3.
Adding Automated Functionality to Office Applications.
Database Software Application
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
VBA (Visual Basic for Applications) What is Excel, just a spreadsheet? Time for Demos...
VBA for Excel. What is a spreadsheet? u An Excel spreadsheet is a set of worksheets  Each worksheets is made up of rows and columns of cells  Rows are.
ChE 117 Motivation Lots of Tools Can’t always use “Canned Programs”
EXCEL 2007 MACROS.  TOM FARRAR OF CNEXTWAVE INC.  GOAL : LEARNING ABOUT EXCEL MACROS.  PRESENTATION INCLUDES DISCUSSION AND DEMONSTRATION.  QUESTIONS.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Introduction to Engineering Computing GEEN 1300 Lecture 7 15 June 2010 Review for midterm.
Microsoft Excel Macros & Excel Solver (IENG490)
Introduction on VBA Lab 05 ins.Tahani Al_dweesh. Lab Objectives Introduction Calculation with VBA Storing and Retrieving Variables in a Worksheet Using.
Choose between Access and Excel Right questions, right program If you’re having trouble choosing between Access and Excel, take a moment to answer an important.
University of Toronto at Scarborough © Andria Hunter, Kersti Wain-Bantin CSCA01 VBA 1 Lecture Outline Record macro and examine VBA code VBA Editor (IDE)
44221: Information Systems Lecture 8 (Week 10) Spreadsheet Automation By Ian Perry
Week 3.  Assessed Exercise 1  Working with ranges.
CSE Introduction to Computing Concepts. Outline  What is an application program?  What is Excel?  Creating a Simple Workbook  Writing Formulas.
Introduction to Excel 2010 Written by: Andie Philo.
Visual Basic for Applications Macro Programming For Microsoft Office.
VBA Lab 2 I ns.Samia Al-blwi. Visual Basic Grammar Object: Visual Basic is an object-oriented language. This means that all the items in Excel are thought.
1 Microsoft Excel An Introduction to Spreadsheets Lecture 18.
Chapter 9 Macros And Visual Basic For Applications.
P6 BTEC Level 3 Subsidiary Diploma in ICT. Automation The end user of a spreadsheet may be proficient in using the software, but the more that you automate.
What is Excel 2010? Spreadsheet Program – Word is a ______________________ program – PowerPoint is a _________________ program Office 2010 – Office Home.
Visual Basic  Is the language for programming in Word, Access,& Excel  Is the “Environment” in which the programming is done (called the Integrated Development.
Spreadsheet Vocabulary.  Spreadsheet = an electronic document in which data is arranged in the rows and columns of a grid and can be manipulated and.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
M4 BTEC Level 3 Subsidiary Diploma in ICT. Technical Documentation The technical documentation may be a section in the user documentation or could be.
Visual Basic Objects / Properties / Methods PropertyAdjective ObjectNoun Part of the application Attribute MethodVerb Action to do something.
What is Excel 2003? Spreadsheet Program – Word is a ______________________ program – PowerPoint is a _________________ program Office 2003/2010 – Office.
Introduction to Spreadsheets The ‘Quick’ and ‘Easy’ guide to using Microsoft Excel.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Microsoft Excel 2007 Noris Bt. Ismail Faculty of Information and Communication Technology Tel : (Ext 8408) BCOMP0101.
VBA Excel Macro 1.Create a Macro: To create a macro in Excel VBA, Create a Macro: To create a macro in Excel VBA,Create a Macro: To create a macro.
Excel Tutorial 8 Developing an Excel Application
Microsoft Excel.
Developing an Excel Applications
Exploring Excel Chapter 7 Automating Repetitive Tasks: Macros and
VBA - Excel VBA is Visual Basic for Applications
MS-EXCEL SUMMARY.
VBA (Visual Basic for Applications) What is Excel, just a spreadsheet?
Microsoft Excel 2003 Illustrated Complete
Learning Excel Session 9 and 10 Dr. Chaitali Basu Mukherji.
Introducing VBA Macros
Exploring Microsoft Excel
IS-171 Computing With Spreadsheets
Parts of an Excel Window
Spreadsheet.
Activate a range and manipulating activated range
Microsoft Office Excel 2003
Computer Science 10 & ICT 9 EXCEL
VBA Kick-Off Session Duncan Young
Presentation transcript:

Programming Excel Macros, Visual Basic, and Solving Your Problem

Macros You’ve seen macros in use. They can automate tasks for you, but making them very general is difficult. Knowing Visual Basic allows you to make Excel do virtually anything.

Things to know: Code How we tell the computer to do things. Data storage How we keep information we need. Excel’s Object Model How we talk about the parts of Excel.

Code We’ll spend several weeks on this. Very precise, very picky, very detailed.

Data Storage Data can be stored in the program (i.e. In RAM) or in files. Data can be stored in Excel Data comes in different types. We’ll handle these as needed.

Excel’s Object Model What is an Object Model? A formal description of how a computer program is put together and how its various parts can be accessed. Using the Object Model Once you understand the Object Model, you can manipulate Excel in your programs.

Objects Have: Properties Characteristics of the Object These can frequently be changed Methods & Events Actions the object can perform. Sub-Objects Objects can contain other objects.

Finding Out about Objects Record a Macro This gives you some sample code that manipulates the object. Use the Object Browser Requires that you have an idea of what you’re looking for.

Referring to Objects Objects and/or properties can be specified by connecting them with periods. This works much like a pathname It lets you become more and more specific Example: Workbooks(“Sheet1”).Cells(1,1)

Workbook The workbook is the Object that contains everything else. The workbook contains worksheets, charts, and modules Worksheets: What you’ve been using. Charts: Ditto. Modules: What you’ll learn to write, contains code.

Worksheets Contain Ranges Contain Cells Specified by their row and column Identified by Name Worksheets(“Sheet1”)

Ranges Rectangular blocks of cells. The basic unit of the worksheet. (Not the cell, which is weird) These have properties Addressed as you’ve seen earlier. A1:A1 or A1:C3 Can be combined with others: Worksheet(“Sheet 1”).Range(“A1:A5”)

Cells These are individual cells that can be given values. Worksheets(“Sheet 1”).Cells(1,2) is cell B1 Row reference, then column (reverse of B1 scheme). Cells have properties that can be changed.

Code Two kinds of interactions: Functional Sub Program

Functions Functions allow you to calculate something that is then returned to the cell. Functions should not change the object model. Evaluated by the spreadsheet when needed. Nice way to encapsulate information.

Sub Programs Called “Sub” Subs can change the object model. Subs are run by the user when they decide to. Another way to encapsulate parts of your program.

Other Actions Msgbox Lets you give a message to the user without disrupting the spreadsheet. Lots of options for this function, see documentation for details. Inputbox Lets you get information from the user without using a cell on the sheet.