Objects and Basic Programming Concepts (See Chapters 5 (skip ED 3), 6 of Albright) (See Chapters 5 (skip ED 4), 6 of Albright)
|
|
- Patience Payne
- 6 years ago
- Views:
Transcription
1 Objects and Basic Programming Concepts (See Chapters 5 (skip ED 3), 6 of Albright) (See Chapters 5 (skip ED 4), 6 of Albright) Kipp Martin January 12, 2012
2 Excel Files Files used in this lecture: vbintroclean.xlsm rangeobject.xlsm variables.xlsm
3 Outline 3 Brief Review Simple I/O Variables: Part I Range Object Math Functions A Digression: With Blocks Important Pages
4 Brief Review 4 A class is characterized by its members. There are three types of members. methods or functions properties or data members events An object is a specific instance of a class. For example, Dim ws As Worksheet Set ws = Worksheets("DemoObject")
5 Brief Review Dot notation: We access members of an object by using dot notation. ws.range("a1").font.size = 22 What is ws? What is Range( A1 )? What is Font? What is Size?
6 Brief Review Sub SortStops() Range("A3:D15").Select Selection.AutoFilter Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom Range("A1").Select End Sub What are the member methods above? What are the method arguments
7 Brief Review 1. Make use of the Object Browser 2. Make use of Intellisense (or the Dummy Reminder as a former student once said)
8 Simple I/O In VBA it is often useful to output values of the variables. There are two easy ways to do this. Method 1: Use the MsgBox Method 2: Use Debug.Print Dim temp1 As Integer, temp2 As Integer temp1 = 5 temp2 = 7 MsgBox temp1 MsgBox temp2 MsgBox temp1 + temp2 MsgBox "Hello World" Debug.Print temp2
9 Simple I/O Debug.Print prints to the Immediate Window. To open the Immediate Window, in the VBA Editor go to the View menu item. Select Immediate Window
10 Simple I/O It is also easy to get data into the VBA program. Use InputBox. Two arguments. Argument One: message to user Argument Two: Title of InputBox Dim stockprice As Double stockprice = InputBox("Enter the Stock Price", _ "Stock Price") Debug.Print stockprice
11 11 Variables and DataTypes In VBA you will work with variables that are defined to be a Data Types. The ones we will work with most frequently are: Integer (-32,768 and 32,767) Long (2,147,483,648 to 2,147,483,647) Double Date Currency String Boolean Range Worksheet Object Variant
12 Variables and DataTypes Statically Typed Language: variables are fixed at compile time. With a statically typed language must declare variable type before using it. Examples include Java and C/C++. Dynamically Typed Language: types are discovered at run time based on how they are used. Scripting languages such as Python and VBA are dynamically typed. Critical: Make VBA statically typed using Option Explicit
13 Variables and DataTypes Strongly Typed Language: Data types are always enforced. The following is not allowed in strongly typed language such as Java or Python, but is allowed in VBA. Dim type1 As String type1 = "12" Dim type2 As Integer type2 = 3 MsgBox type1 / type2 Weakly Typed Language: Types are combined and the compiler tries to make sense of what you are doing. VBA and C/C++ are weakly typed (actually C/C++ not nearly as weakly typed as VBA). Not all scripting languages are weakly typed (e.g. Python is not).
14 Variables and DataTypes In VBA a variable is explicitly declared using the Dim and As keywords. The syntax is Dim variable As DataType Important: In VBA variable names are case sensitive. The Dim statement is explicitly declaring a variable. You can also do it implicitly. i = 5 Don t do this!!!!!!!!! Don t do this!!!!!!!!! Start your modules with Option Explicit Tools > Options Check "Require Variable Definition"
15 Variations on a theme Dim i As Integer Dim j As Integer Dim k As Integer OR Variables and DataTypes Dim i As Integer, j As Integer, k As Integer ALSO POSSIBLE Dim i As Integer, s As String, x As Double NOT Dim i, j, k As Integer In this case i and j end up as Variant not integer which is bad.
16 Integers, Doubles, Currency, and Date Variables that are numbers will usually be integers, doubles, currency, or date Data Types. Dim age As Integer Dim x As Double Dim birthday As Date Dim money as Currency age = 33 x = 32.7 birthday = #1/3/75# age = Year( Now()) - Year(birthday) MsgBox "Age = " & age money = VBA.Format( , "Currency") MsgBox "Salary = $" & money
17 String Variables Dim firstname As String Dim lastname As String Dim midinitial As String * 1 Dim fullname As String firstname = "John" lastname = "Doe" midinitial = "Q" fullname = firstname & midinitial & lastname MsgBox fullname Note how strings are defined using the Note how strings are added (concatenated)
18 Converting String Variables You can t manipulate string data as numbers. For example, do not: Dim myvar1 As String Dim myvar2 As String Dim myvar3 As Double myvar1 = "32.46" myvar2 = "77.9" myvar3 = myvar1 + myvar2 MsgBox myvar3 Instead use the string conversion functions CDbl and CInt to convert text to numbers. Use CStr to convert numbers to strings.
19 Converting String Variables Sub StringOps() Dim myvar1 As String Dim myvar2 As String Dim myvar3 As String myvar1 = "32.46" myvar2 = "77.9" myvar3 = myvar1 + myvar2 MsgBox myvar3 Dim dval1 As Double, _ dval2 As Double, dval3 As Double dval1 = CDbl(myVar1) dval2 = CDbl(myVar2) dval3 = dval1 + dval2 MsgBox dval3 End Sub
20 String Variables 20 Some neat string functions: The string length function Dim myvar1 As String myvar1 = "Bus 36104" MsgBox Len(myVar1) What is the result?
21 String Variables Some neat string functions: getting segments of a string Dim rightstring, midstring, leftstring As String Dim teststring As String teststring = "Applications Development with VBA" rightstring = Right(testString, 5) midstring = Mid(testString, 2, 7) leftstring = Left(testString, 7) MsgBox rightstring MsgBox midstring MsgBox leftstring What is the result?
22 String Variables The string functions built into VBA are actually rather limited. For example, you might like to search a string to see if it contains text of interest. You can take advantage of built-in Excel functions for this. More later.
23 Boolean Variables Boolean variables take on values of True or False. Boolean variables are used in logical tests (If, While, etc.). Dim test As Boolean test = True
24 Values for Data Types Here are some ranges on common data types. Integer: stored in two bytes can take values -32,768 to 32,767 Double: stored in eight bytes and can take values in the range E308 to E-324 for negative values; E-324 to E308 for positive values Date: stored in eight bytes and takes a value from January 1, 100 to December 31, 9999 Currency: stored in eight bytes and takes a value with a range of -922,337,203,685, to 922,337,203,685, String: variable length, can go up to approximately 2 billion characters Boolean: two bytes True or False
25 Range Variables We can declare Range variables. This variable will have access to all of the properties and methods of the Range class. Dim rng As Range Set rng = Range("A1") Note the use of Set. You need to use the Set keyword when defining a range object.
26 Range Variables: StartCell, EndCell When writing code we may to treat the start and end of a range as a variable. Rather than copying exact cell names we can point to start or end cells. Dim StartCell As Range Dim EndCell As Range rangestart = InputBox("Enter Start Cell") Set StartCell = Range(rangeStart) rangeend = InputBox("Enter End Cell") Set EndCell = Range(rangeEnd) Set rng = Range(StartCell, EndCell) rng.select MsgBox "The range is: " & rng.address
27 Worksheet Variables Dim ws As Worksheet Set ws = Worksheets("Sheet1") We use the Set keyword again when working with the Worksheet class We use Worksheets( Sheet1 ) NOT Worksheet( Sheet1 )
28 Object Variables You can declare a generic object variable. This can be a Range, Worksheet, Drawing Object, whatever. Dim myobj As Object Set myobj = rng Set myobj = ws ws.shapes.addshape(msoshaperectangle, , 289.5, _ 50, 100).Select
29 Constant Variables By definition variables are just that variable, they can change as the procedure changes. Dim myint As Integer myint = 57 Do some work Do some more work myint = 59 However, there is a such a thing as a constant variable. This is variable that cannot change during execution. Const MY_PIE = 3.14 Const MY_INFINITY It is common to use all upper case for constant variables although this is not necessary.
30 Range Object The range object is probably the most important object you will work with. In VBA it is critical to be able to refer to ranges, and parts of ranges, in your code. Method 1: Cell Address Dim rng As Range Set rng = Range("A1:G12") Method 2: Range Name Dim rng As Range Set rng = Range("tax_rates")
31 Range Object Method 3: Cells Property This uses the standard (i, j) matrix notation. Range("A1:A100").Cells(7) refers to cell $A$7 Note: you can always check to see cells the range refers to. Dim rng As Range Set rng = Range("A1:A100").Cells( 7) MsgBox "The Range address is: " & rng.address
32 Range Object (Cell Property Continued) Method 3: Cells Property This uses the standard (i, j) matrix notation. Range("A1:D100").Cells(3, 2) refers to cell $B$3 Range("E3:G100").Cells(3, 2) refers to cell $F$5
33 Range Object Method 4: Offset Property This takes two arguments, but the origin of the range is (0,0) in the upper left and we offset the start and end by the amount of the offset. Range("A1:D3").Offset(0, 0) refers to cell $A$1:$D$3 Range("A1:D3").Offset(1, 1) refers to cell $B$2:$E$4 Contrast with Range("A1:D3").Cells(1, 1) refers to cell $A$1 Range("A1:D3").Offset(3, 2) refers to cell $C$4:$F$6 Range("E3:G100").Offset(3, 2) refers to cell $G$6:$I$103 Range("A1").Offset(3, 2) refers to cell $C$4
34 Range Object Method 5: Upper Left, Bottom Right You can define a range by specifying the upper left cell and bottom right cell. Range("A1", "B2") refers to Range $A$1:$B$2 Range( Range("A1"), Range( B2 ) ) refers to Range $A$1:$B$2 Range( Range("A1").Offset(1, 1), Range("A1").Offset(3, 4) ) refers to Range $B$2:$E$4 You will see in an exercise how this is very useful.
35 End Property Method 6: Using the End Property This is very useful when you don t know the size of a rage ahead of time. Range("G1", Range("G1").End(xlToRight)).Name = "Quizzes" Range("G1", Range("G1").End(xlToRight)).Select There is also an xldown
36 Counting Range Size It is often useful to know how many rows and columns are in a range. Dim rng As Range Set rng = Range("A3:D50") MsgBox "Num rows = " & rng.rows.count MsgBox "Num cols = " & rng.columns.count
37 Writing to the Worksheet There are a lot of ways to enter text or formulas into a cell. Sub WriteToRange() Dim ws As Worksheet Set ws = Worksheets("writeRange") Dim rng As Range Set rng = Range("A1:A3") Range("A1").Formula = "=B1" rng.cells(2, 1) = "=B2" Range("A3") = "=B3" Range("A4").FormulaR1C1 = "=RC[1]" End Sub
38 Math Functions Key Idea: There are a number of math functions in VBA that you can use without using any cell references. 38
39 Functions Using Excel built-in functions: Dim x, y As Double x = 100 y = Sqr(100) MsgBox "y = " & y x = Exp(1) y = Log(x) MsgBox "y = " & y
40 Math Functions You can also use the wide variety of Excel built-in functions (really useful when you are working with the range object). Dim x, y As Double x = Application.WorksheetFunction.Sum(Range("numbersRange")) y = Application.WorksheetFunction.Log10(10) MsgBox x MsgBox y
41 Math Functions 41 Another Approach: Dim ws As Worksheet Set ws = Worksheets("Sheet3") Range("A1").Value = "=Log10(10)" ws.range("a11").value = "=Sum(numbersRange)"
42 Math Functions Using a String Function: Dim pos As Integer Dim mystring As String mystring = "Goodbye Cruel World" pos = _ Application.WorksheetFunction.Find("Cruel", mystring, 1) Debug.Print pos
43 With Block When setting numerous properties for a Range object you can save effort by using a With block. The general structure is: With ObjectName.property.method End With Range("A1").Value = Range("A1").Name = "SalesPrice" Range("A1").Font.Size = 12 Range("A1").Font.Italics = True Range("A1").Font.Name= "Time New Roman"
44 With Block Range("A1").Value = Range("A1").Name = "SalesPrice" Range("A1").Font.Size = 12 Range("A1").Font.Italics = True Range("A1").Font.Name= "Time New Roman" With Range("A1").Value = Name = "SalesPrice" With.Font.Size = 12.Italic = True.Name= "Time New Roman" End With End With
45 Important Pages Highly Recommended: pages (Third Edition) pages (Third Edition) pages (Fourth Edition) pages (Fourth Edition)
46 Summary Tips Use the object browser Use the idiot completion Make use of the Range Address property Make use of the Range Count property Use an underscore to continue a line Use a single quote for a comment
Excel VBA Variables, Data Types & Constant
Excel VBA Variables, Data Types & Constant Variables are used in almost all computer program and VBA is no different. It's a good practice to declare a variable at the beginning of the procedure. It is
More informationVBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type >
VBA Handout References, tutorials, books Excel and VBA tutorials Excel VBA Made Easy (Book) Excel 2013 Power Programming with VBA (online library reference) VBA for Modelers (Book on Amazon) Code basics
More informationEXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING
EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING TABLE OF CONTENTS 1. What is VBA? 2. Safety First! 1. Disabling and Enabling Macros 3. Getting started 1. Enabling the Developer tab 4. Basic
More informationLearning Excel VBA. About Variables. ComboProjects. Prepared By Daniel Lamarche
Learning Excel VBA About Variables Prepared By Daniel Lamarche ComboProjects About Variables By Daniel Lamarche (Last update February 2017). The term variables often send shivers in the back of many learning
More informationBASIC MACROINSTRUCTIONS (MACROS)
MS office offers a functionality of building complex actions and quasi-programs by means of a special scripting language called VBA (Visual Basic for Applications). In this lab, you will learn how to use
More informationVisual Basic for Applications
Visual Basic for Applications Programming Damiano SOMENZI School of Economics and Management Advanced Computer Skills damiano.somenzi@unibz.it Week 1 Outline 1 Visual Basic for Applications Programming
More informationVBA Collections A Group of Similar Objects that Share Common Properties, Methods and
VBA AND MACROS VBA is a major division of the stand-alone Visual Basic programming language. It is integrated into Microsoft Office applications. It is the macro language of Microsoft Office Suite. Previously
More informationDATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan
DATA 301 Introduction to Data Analytics Microsoft Excel VBA Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Microsoft Excel Visual Basic
More informationOutline. Midterm Review. Using Excel. Midterm Review: Excel Basics. Using VBA. Sample Exam Question. Midterm Review April 4, 2014
Midterm Review Larry Caretto Mechanical Engineering 209 Computer Programming for Mechanical Engineers April 4, 2017 Outline Excel spreadsheet basics Use of VBA functions and subs Declaring/using variables
More informationd2vbaref.doc Page 1 of 22 05/11/02 14:21
Database Design 2 1. VBA or Macros?... 2 1.1 Advantages of VBA:... 2 1.2 When to use macros... 3 1.3 From here...... 3 2. A simple event procedure... 4 2.1 The code explained... 4 2.2 How does the error
More informationVba Variables Constant and Data types in Excel
Vba Variables Constant and Data types in Excel VARIABLES In Excel VBA, variables are areas allocated by the computer memory to hold data. Data stored inside the computer memory has 4 properties: names,
More informationSébastien Mathier wwwexcel-pratiquecom/en Variables : Variables make it possible to store all sorts of information Here's the first example : 'Display the value of the variable in a dialog box 'Declaring
More informationMS Excel VBA Class Goals
MS Excel VBA 2013 Class Overview: Microsoft excel VBA training course is for those responsible for very large and variable amounts of data, or teams, who want to learn how to program features and functions
More informationLecture-14 Lookup Functions
Lecture-14 Lookup Functions How do I write a formula to compute tax rates based on income? Given a product ID, how can I look up the product s price? Suppose that a product s price changes over time. I
More informationHOW TO ACE THE 21 MOST COMMON QUESTIONS IN VBA 1
TABLE OF CONTENTS Introduction Where does Debug.Print write to? How to open a closed Workbook How to find the last row How to use VLookup How to return a value from a function How to add a formula to a
More informationLearning Excel VBA. Using Loops in Your Code. ComboProjects. Prepared By Daniel Lamarche
Learning Excel VBA Using s in Your Code Prepared By Daniel Lamarche ComboProjects Using s in Your Code By Daniel Lamarche (Last update June 2016). s are pretty simple in concept however many new programmers
More informationFunction Exit Function End Function bold End Function Exit Function
The UDF syntax: Function name [(arguments) [As type] ] [As type] [statements] [name = expression] [Exit Function] [statements] [name = expression] - name the name of the function - arguments a list of
More informationvariables programming statements
1 VB PROGRAMMERS GUIDE LESSON 1 File: VbGuideL1.doc Date Started: May 24, 2002 Last Update: Dec 27, 2002 ISBN: 0-9730824-9-6 Version: 0.0 INTRODUCTION TO VB PROGRAMMING VB stands for Visual Basic. Visual
More informationControl Statements Selection (Conditional Logic)
Control Statements Selection (Conditional Logic) INTRODUCTION In the last few weeks, you were introduced to the concept of flow of control: the sequence of statements that the computer executes. In procedurally
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationChapter 2 Working with Data Types and Operators
JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics
More informationSébastien Mathier www.excel-pratique.com/en Selections : We'll begin by creating a macro that selects the cell that we specifiy. First open the editor and add a module : In the module, type "sub selection"
More informationMy Report Project. The First Excel VBA Macro Project. ComboProjects. Prepared By Daniel Lamarche
My Report Project The First Excel VBA Macro Project Prepared By Daniel Lamarche ComboProjects The My Report macro project By Daniel Lamarche (Last update January 2016). In this project we will records
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationVBScript: Math Functions
C h a p t e r 3 VBScript: Math Functions In this chapter, you will learn how to use the following VBScript functions to World Class standards: 1. Writing Math Equations in VBScripts 2. Beginning a New
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More information6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:
VBA program units: Subroutines and Functions Subs: a chunk of VBA code that can be executed by running it from Excel, from the VBE, or by being called by another VBA subprogram can be created with the
More informationAppendix A1 Visual Basics for Applications (VBA)
Credit Risk Modeling Using Excel and VBA with DVD By Gunter Löffler and Peter N. Posch 2011 John Wiley & Sons, Ltd. Appendix A1 Visual Basics for Applications (VBA) MACROS AND FUNCTIONS In this book, we
More informationMICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION
MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION Lesson 1 - Recording Macros Excel 2000: Level 5 (VBA Programming) Student Edition LESSON 1 - RECORDING MACROS... 4 Working with Visual Basic Applications...
More informationReview for Programming Exam and Final May 4-9, Ribbon with icons for commands Quick access toolbar (more at lecture end)
Review for Programming Exam and Final Larry Caretto Mechanical Engineering 209 Computer Programming for Mechanical Engineers May 4-9, 2017 Outline Schedule Excel Basics VBA Editor and programming variables
More informationCSE 123 Introduction to Computing
CSE 123 Introduction to Computing Lecture 6 Programming with VBA (Projects, forms, modules, variables, flowcharts) SPRING 2012 Assist. Prof. A. Evren Tugtas Starting with the VBA Editor Developer/Code/Visual
More informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations Data and Operations
More informationAssessed Exercise 1 Working with ranges
Week 3 Assessed Exercise 1 Working with ranges Multiple representations Different thing in different cases Single cell Collection of cells The handle to the thing you want to work with Many operations
More informationVariables in VB. Keeping Track
Variables in VB Keeping Track Variables Variables are named places in the computer memory that hold information. Variables hold only a single value at a time. Assigning a new value to them causes the old
More informationEnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages
EnableBasic Old Content - visit altium.com/documentation Modified by Admin on Sep 13, 2017 Parent page: Scripting Languages This Enable Basic Reference provides an overview of the structure of scripts
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationObject Oriented Programming with Visual Basic.Net
Object Oriented Programming with Visual Basic.Net By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend (c) Copyright 2007 to 2015 H. Hakimzadeh 1 What do we need to learn in order
More informationCSE 123 Introduction to Computing
CSE 123 Introduction to Computing Lecture 11 Programming with Arrays SPRING 2012 Assist. Prof. A. Evren Tugtas Array Variables Review For detailed information on array variables look at the notes of Lecture
More informationprintf( Please enter another number: ); scanf( %d, &num2);
CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful
More informationData Types, Variables and Arrays. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Data Types, Variables and Arrays OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani Identifiers in Java Identifiers are the names of variables, methods, classes, packages and interfaces. Identifiers must
More informationLmÉPï C Á npï À ƵÀ ïì itech Analytic Solutions
LmÉPï C Á npï À ƵÀ ïì itech Analytic Solutions No. 9, 1st Floor, 8th Main, 9th Cross, SBM Colony, Brindavan Nagar, Mathikere, Bangalore 560 054 Email: itechanalytcisolutions@gmail.com Website: www.itechanalytcisolutions.com
More informationUnit 6 - Software Design and Development LESSON 4 DATA TYPES
Unit 6 - Software Design and Development LESSON 4 DATA TYPES Previously Paradigms Choice of languages Key features of programming languages sequence; selection eg case, if then else; iteration eg repeat
More informationExcel Macro Record and VBA Editor. Presented by Wayne Wilmeth
Excel Macro Record and VBA Editor Presented by Wayne Wilmeth 1 What Is a Macro? Automates Repetitive Tasks Written in Visual Basic for Applications (VBA) Code Macro Recorder VBA Editor (Alt + F11) 2 Executing
More information20. VB Programming Fundamentals Variables and Procedures
20. VB Programming Fundamentals Variables and Procedures 20.1 Variables and Constants VB, like other programming languages, uses variables for storing values. Variables have a name and a data type. Array
More informationLSP 121. LSP 121 Math and Tech Literacy II. Topics. More VBA. More VBA. Variables
Greg Brewster, DePaul University Page 1 Math and Tech Literacy II Greg Brewster DePaul University Topics More Visual Basic Variables Naming Rules Implicit vs. Explicit Types Variable Lifetime Static variables
More informationLotus Notes Application design & programming. By Ajith Thulaseedharan Lotus Notes developer
Lotus Notes Application design & programming By Ajith Thulaseedharan Lotus Notes developer A Notes application Is a.nsf(notes Storage Facility) database Is a structured flat file Contains notes data &
More informationUnit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types
Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationCS 200. Lecture 05. Excel Scripting. Excel Scripting. CS 200 Fall 2014
CS 200 Lecture 05 1 Abbreviations aka CWS VBE intra- inter- Also Known As Miscellaneous Notes Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus
More informationIntroduction to programming with Python
Introduction to programming with Python Ing. Lelio Campanile 1/61 Main Goal - Introduce you to programming - introduce you to the most essential feature of python programming 2/61 Before to start The name
More informationCS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Spring Wednesday, June 18, 2014
CS 200 Lecture 07 1 Miscellaneous Notes Abbreviations aka CWS VBE intra- inter- Also Known As Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus
More informationCS 200. Lecture 05! Excel Scripting. Miscellaneous Notes
CS 200 Lecture 05! 1 Abbreviations aka CWS VBE intra- inter- Also Known As Miscellaneous Notes Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus
More informationStart Visual Basic. Session 1. The User Interface Form (I/II) The Visual Basic Programming Environment. The Tool Box (I/II)
Session 1 Start Visual Basic Use the Visual Basic programming environment Understand Essential Visual Basic menu commands and programming procedure Change Property setting Use Online Help and Exit Visual
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Java basics: Compilation vs Interpretation Program structure Statements Values Variables Types Operators and Expressions
More information3. (1.0 point) To quickly switch to the Visual Basic Editor, press on your keyboard. a. Esc + F1 b. Ctrl + F7 c. Alt + F11 d.
Excel Tutorial 12 1. (1.0 point) Excel macros are written in the programming language. a. Perl b. JavaScript c. HTML d. VBA 2. (1.0 point) To edit a VBA macro, you need to use the Visual Basic. a. Manager
More informationVariables and numeric types
s s and numeric types Comp Sci 1570 to C++ types Outline s types 1 2 s 3 4 types 5 6 Outline s types 1 2 s 3 4 types 5 6 s types Most programs need to manipulate data: input values, output values, store
More informationGood Variable Names: dimensionone, dimension1 Bad Variable Names: dimension One, 1dimension
VB Scripting for CATIA V5: Email Course by Emmett Ross Lesson #4 - CATIA Macro Variable Naming Variables make up the backbone of any programming language. Basically, variables store information that can
More informationLesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 02 Data Types and Statements MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Topics Covered Statements Variables Constants Data Types
More informationExpressions and Variables
Expressions and Variables Expressions print(expression) An expression is evaluated to give a value. For example: 2 + 9-6 Evaluates to: 5 Data Types Integers 1, 2, 3, 42, 100, -5 Floating points 2.5, 7.0,
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationIntroduction to VBA for Excel-Tutorial 7. The syntax to declare an array starts by using the Dim statement, such that:
Introduction to VBA for Excel-Tutorial 7 In this tutorial, you will learn deal with arrays. We will first review how to declare the arrays, then how to pass data in and how to output arrays to Excel environment.
More informationC++ Basics. Lecture 2 COP 3014 Spring January 8, 2018
C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing
More informationCS 200. Lecture 07. Excel Scripting. Miscellaneous Notes
CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular
More informationData and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence
Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public
More informationCS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Fall 2016
CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular
More informationCS 200. Lecture 07. Excel Scripting. Miscellaneous Notes
CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular
More informationCreating Visual Basic Macros that Use Microsoft Excel Solver
Creating Visual Basic Macros that Use Microsoft Excel Solver 1. What Is Microsoft Excel Solver? 2. Using the Solver Functions in a Visual Basic Macro 3. Designing a Macro that Creates and Solves a Simple
More information3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
More informationOn this class sheet, we can specify the members (properties and methods) that the objects created using this template will have.
Classes A class is a template for creating our own objects. In Excel VBA a class comes in the form of a special sheet which we can inset into our program. On this class sheet, we can specify the members
More informationIFA/QFN VBA Tutorial Notes prepared by Keith Wong
Chapter 2: Basic Visual Basic programming 2-1: What is Visual Basic IFA/QFN VBA Tutorial Notes prepared by Keith Wong BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code. It is a type
More informationVisual basic tutorial problems, developed by Dr. Clement,
EXCEL Visual Basic Tutorial Problems (Version January 20, 2009) Dr. Prabhakar Clement Arthur H. Feagin Distinguished Chair Professor Department of Civil Engineering, Auburn University Home page: http://www.eng.auburn.edu/users/clemept/
More informationIntroduction to Data Entry and Data Types
212 Chapter 4 Variables and Arithmetic Operations STEP 1 With the Toolbox visible (see Figure 4-21), click the Toolbox Close button. The Toolbox closes and the work area expands in size.to reshow the Toolbox
More informationCPS122 Lecture: From Python to Java last revised January 4, Objectives:
Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.
More informationAccess Forms Masterclass 5 Create Dynamic Titles for Your Forms
Access Forms Masterclass 5 Create Dynamic Titles for Your Forms Published: 13 September 2018 Author: Martin Green Screenshots: Access 2016, Windows 10 For Access Versions: 2007, 2010, 2013, 2016 Add a
More informationLanguage Fundamentals
Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long
More informationUnit 3. Constants and Expressions
1 Unit 3 Constants and Expressions 2 Review C Integer Data Types Integer Types (signed by default unsigned with optional leading keyword) C Type Bytes Bits Signed Range Unsigned Range [unsigned] char 1
More informationIntroduction... 1 Part I: Getting Started with Excel VBA Programming Part II: How VBA Works with Excel... 31
Contents at a Glance Introduction... 1 Part I: Getting Started with Excel VBA Programming... 9 Chapter 1: What Is VBA?...11 Chapter 2: Jumping Right In...21 Part II: How VBA Works with Excel... 31 Chapter
More informationPython for Analytics. Python Fundamentals RSI Chapters 1 and 2
Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,
More informationIntroduction to Programming
Introduction to Programming René Thiemann Institute of Computer Science University of Innsbruck WS 2008/2009 RT (ICS @ UIBK) Chapter 3 1/32 Outline Foundations of Object Orientation Data hiding RT (ICS
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationReferences. Notices Week 5. A Note on the Textbook. Algorithms and programs. Context
ENGG1811 Computing for Engineers Week 5 Introduction to Programming and Visual Basic for Applications References Chapra (std text Part 2), Topics 8, 9 (Chapters 1, 2). Some of this week s material is derived
More information7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING
KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve
More informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationVARIABLES AND TYPES CITS1001
VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data
More informationWelcome to Introduction to Microsoft Excel 2010
Welcome to Introduction to Microsoft Excel 2010 2 Introduction to Excel 2010 What is Microsoft Office Excel 2010? Microsoft Office Excel is a powerful and easy-to-use spreadsheet application. If you are
More informationPython Intro GIS Week 1. Jake K. Carr
GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes
More informationMs Excel Vba Continue Loop Through Range Of
Ms Excel Vba Continue Loop Through Range Of Rows Learn how to make your VBA code dynamic by coding in a way that allows your 5 Different Ways to Find The Last Row or Last Column Using VBA In Microsoft
More informationBASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation
BASIC EXCEL SYLLABUS Section 1: Getting Started Unit 1.1 - Excel Introduction Unit 1.2 - The Excel Interface Unit 1.3 - Basic Navigation and Entering Data Unit 1.4 - Shortcut Keys Section 2: Working with
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationJython. secondary. memory
2 Jython secondary memory Jython processor Jython (main) memory 3 Jython secondary memory Jython processor foo: if Jython a
More informationExcel VBA Programming
Exclusive Study Manual Excel VBA Programming Advanced Excel Study Notes (For Private Circulation Only Not For Sale) 7208669962 8976789830 (022 ) 28114695 www.laqshya.in info@laqshya.in Study Notes Excel
More informationCS 155 Exam 2 Spring 2015
CS 155 Exam 2 Spring 2015 Name (print): Instructions: Keep your eyes on your own paper, and do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than the professor/proctor
More informationKEYWORDS DDE GETOBJECT PATHNAME CLASS VB EDITOR WITHEVENTS HMI 1.0 TYPE LIBRARY HMI.TAG
Document Number: IX_APP00113 File Name: SpreadsheetLinking.doc Date: January 22, 2003 Product: InteractX Designer Application Note Associated Project: GetObjectDemo KEYWORDS DDE GETOBJECT PATHNAME CLASS
More informationCSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI
CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are
More informationLearning Excel VBA. Creating User Defined Functions. ComboProjects. Prepared By Daniel Lamarche
Learning Excel VBA Creating User Defined Functions Prepared By Daniel Lamarche ComboProjects Creating User Defined Functions By Daniel Lamarche (Last update January 2016). User Defined Functions or UDFs
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationFall 2017 CISC124 9/16/2017
CISC124 Labs start this week in JEFF 155: Meet your TA. Check out the course web site, if you have not already done so. Watch lecture videos if you need to review anything we have already done. Problems
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationConcatenate Function Page 505
Concatenate Function Page 505 The Concatenate Function is used to tie together different text strings. It is useful, for example, if you have columns in your Excel workbook for First Name and Last Name
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More information