OV 2 - 1 Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting.

Slides:



Advertisements
Similar presentations
1B40: Data analysis 1 Objects Visual Basic is an (OO) object-oriented language. Performing a task in Visual Basic (VB) or.
Advertisements

“Going loopy with Visual Basic!”
ISOM3230 Business Applications Programming
One Dimensional Arrays
情報基礎 A Lecture 10 Takeshi Tokuyama Tohoku University Graduate School of Information Sciences System Information Sciences Design and Analysis of Information.
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
EXCEL VBA 101 Current Status Waiting Using Excel/VBA to Speed-up Daily Data Processing An Introduction to VBA Yongjun Chen Click Me to Start …
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.
Week 10.  Protecting Code  Protecting Worksheets  Error Handling  Charts.
Some computer fundamentals and jargon Memory: Basic element is a bit – value = 0 or 1 Collection of “n” bits is a “byte” Collection of several bytes is.
Week 5.  Recap – For Each..Next  Personal Macro File  Immediate window  Object Variables Working with worksheets and workbooks  For Loops.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
VBA for MS Excel Hamze Msheik. Open the Visual Basic Editor in Excel 2007 Click on the Microsoft Office button in the top left of the Excel window and.
Variables in VB Keeping Track. Variables Variables are named places in the computer memory that hold information. Variables hold only a single value at.
VBA Programming Session #2. Things to Review  Variables  Procedures: Subs & Functions  If…Then  For…Next.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Chapter 06: Lecture Notes (CSIT 104) 1 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Copyright © 2008 Prentice-Hall. All rights reserved.
 Excel – Basic Elements  Using Macros  Excel VBA Basics  Excel VBA Advanced.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module M Programming in Excel with VBA.
Object Variables Visual Basic for Applications 3.
© McGraw-Hill Companies, Inc., McGraw-Hill/Irwin Extended Learning Module M Programming in Excel with VBA.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module M Programming in Excel with VBA.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Creating Macros Using VBA. Assigning a Macro to a Button Display the Forms toolbar. Click the Button icon. Click and drag the mouse pointer to specify.
Introduction on VBA Lab 05 ins.Tahani Al_dweesh. Lab Objectives Introduction Calculation with VBA Storing and Retrieving Variables in a Worksheet Using.
OV Copyright © 2011 Element K Content LLC. All rights reserved.  Create a Macro with the Macro Recorder  Edit a Macro  Debug a Macro  Customize.
University of Toronto at Scarborough © Andria Hunter, Kersti Wain-Bantin CSCA01 VBA 1 Lecture Outline Record macro and examine VBA code VBA Editor (IDE)
OV Copyright © 2011 Element K Content LLC. All rights reserved.  Insert, Copy, and Delete Worksheets  Rename Worksheets  Modify the Order of Worksheets.
Week 3.  Assessed Exercise 1  Working with ranges.
Chapter 17: Arrays Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
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.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Date Variables Visual Basic for Applications 5. Objectives n In this tutorial, you will learn how to: n Reserve a Date variable n Use an assignment statement.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Chapter 6 Data Tables and Amortization Tables Exploring Microsoft Office Excel 2007.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Week 4.  Recap – Ranges  For Each Loops  Ranges Referencing Range Objects  Set (keyword)
Visual Basic.net Loops. Used to do multiple executions of the same block of code Do while loops Do until loops For next loops.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Lab 4 Range Review, Control Logic and Loops ► Range Review ► Control Logic and Loops ► Exercise.
I Power Higher Computing Software Development High Level Language Constructs.
OV Copyright © 2011 Element K Content LLC. All rights reserved.  Determine the Dialog Box Type  Capture User Input Creating an Interactive Worksheet.
Lab 6 (2) Arrays ► Lab 5 (1) Exercise Review ► Array Concept ► Why Arrays? ► Array Declaration ► An Example of Array ► Exercise.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
Visual Basic Objects / Properties / Methods PropertyAdjective ObjectNoun Part of the application Attribute MethodVerb Action to do something.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
Introduction to Macros in Excel Franco Musso. ActiveCell.Offset.
More on Variables and Subroutines. Introduction Discussion so far has dealt with self- contained subs. Subs can call other subs or functions. A module.
OV Copyright © 2008 Element K Content LLC. All rights reserved. Working with Web Pages  An Introduction to Cascading Style Sheets  Format a Web.
Excel Introduction to computers. Excel 2007 Starting the Excel program.
VBA Programming for Excel Review Excel Objects Excel Methods Identifying Specific Cells Review Functions for Excel Custom Menus.
OV Copyright © 2011 Element K Content LLC. All rights reserved. Calculating Data with Advanced Formulas  Apply Cell and Range Names  Calculate.
The Advantage Series ©2005 The McGraw-Hill Companies, Inc. All rights reserved Chapter 12 Introducing Visual Basic for Applications Microsoft Office Excel.
Visual Basic 6.0 Final Review
IE 8580 Module 4: DIY Monte Carlo Simulation
VBA - Excel VBA is Visual Basic for Applications
VBA programming for Excel
2007 MICROSOFT EXCEL INTERMEDIATE
JavaScript: Functions.
Learning Excel Session 9 and 10 Dr. Chaitali Basu Mukherji.
Introduction to computers
Process Automation: From models to code
The structure of programming
Activate a range and manipulating activated range
VBA Programming for Excel
Changing the Appearance of a Worksheet
Presentation transcript:

OV Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting Worksheets Using Macros

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Selection Property Selection Property

OV Copyright © 2011 Element K Content LLC. All rights reserved. The ActiveSheet Property ActiveSheet Property

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Name Property ActiveSheet.Name = “Conservative" New name of the worksheet New name of the worksheet Old name of the worksheet Old name of the worksheet Name property of the currently active worksheet

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Value Property Range(“A1”).Value = “Hello” A data value assigned to cell A1 A data value assigned to cell A1

OV Copyright © 2011 Element K Content LLC. All rights reserved. Concatenation “Balanced” & “ ” & “Portfolio” “Balanced Portfolio” Concatenation operator Concatenation operator Pieces of text concatenated Single piece of text resulting from the concatenation Single piece of text resulting from the concatenation

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Range Object Range Object

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Select Method Range(“B6:E6”).Select Range object referring to a specific range Range object referring to a specific range Range selected on the worksheet Range selected on the worksheet

OV Copyright © 2011 Element K Content LLC. All rights reserved. The CurrentRegion Property CurrentRegion Property

OV Copyright © 2011 Element K Content LLC. All rights reserved. Data Types String Data Type Integer Data Type Boolean Data Type Classification of data used in a macro Text Positive or negative whole number Positive or negative whole number True/false value

OV Copyright © 2011 Element K Content LLC. All rights reserved. Option Explicit Sub Variables Ex() Dim x As Integer Dim CustName As String Dim CurrentCust As Boolean x = 39 CustName = "John Smith" CurrentCust = False End Sub Variables Statement used to explicitly declare all variables Statements declaring variables in different data types Statements declaring variables in different data types Data assigned to variables Data assigned to variables

OV Copyright © 2011 Element K Content LLC. All rights reserved. x = y = x > 50 PrenCust = CurrentCust And PastCust Operators

OV Copyright © 2011 Element K Content LLC. All rights reserved. For x = 1 To 12 Worksheets.Add After:=Worksheets(x) Next x The For Next Loop For statement Counter variable Code within the loop that is repeated Code within the loop that is repeated Next statement

OV Copyright © 2011 Element K Content LLC. All rights reserved. Dim counter, factorial As Integer Counter = 10 Do factorial = factorial * counter counter = counter – 1 Loop While counter > 0 The Do Loop Do statement Code that gets executed each time Code that gets executed each time While criterion Loop statement

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Count Property Three sheets Worksheets.Count

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Offset Property ActiveCell.Offset(-3, -2) ActiveCell.Offset(3, 2) Column reference Positive values move offset down and right Positive values move offset down and right Negative values move offset up and left Negative values move offset up and left Row reference

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Copy Method ActiveSheet.Copy Data copied to the Clipboard Data copied to the Clipboard Copy method

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Paste Method ActiveSheet.Paste Paste method Data from the Clipboard pasted to the sheet

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Columns Property Columns(“B:E”).Select Column range specified within parentheses Columns property and Select method select a column

OV Copyright © 2011 Element K Content LLC. All rights reserved. The AutoFit Method Columns(B:E).AutoFit AutoFit method

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Address Property ActiveCell.Value = ActiveCell.Address Address property

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Call Statement Sub MasterMac() Call InsertHeader Call FormatHeader Call InsertData Call FormatData End Sub Module containing component macros

OV Copyright © 2011 Element K Content LLC. All rights reserved. The Font Property ActiveCell.Font.Name = “Old English MT” Font property

OV Copyright © 2011 Element K Content LLC. All rights reserved. The End Property Range(“C50”).Select ActiveCell.End(x1Up) End property Direction of the last cell

OV Copyright © 2011 Element K Content LLC. All rights reserved. 1. Which manual formatting tasks will you want to replace with a macro? 2. Which coding technique will you use often when creating macros for formatting data? Reflective Questions