27 - IE 212 Computational Methods for Industrial...

Info icon This preview shows pages 1–7. Sign up to view the full content.

Saeed Ghanbartehrani Winter 2016 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Variable Declaration in Excel VBA (cont.) 2 In Excel VBA, the type of each variable must be set individually For example, assume that you would like to declare variables var1 and var2 as type Integer . Which statement should you use? a) Dim var1 As Integer, var2 As Integer b) Dim var1, var2 As Integer c) Both a) and b) will work
Image of page 2
Variable Declaration in Excel VBA (cont.) 3 In Excel VBA, you can also define constant variables Use the keyword Const to declare a constant variable Const var_Name = Value Const pi = 3.141593 One a constant is declared, it cannot be modified or assigned a new value in the code
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Integer and Double Data Types 4 Numerical values can be represented with both the Integer and Double data types Type Integer Non-decimal numbers that range in value from -32,768 to 32,767 Used for simple numerical values, counting in loops, and enumerating arrays Type Double Negative range -1.79769E308 to -4.94065E-324 Positive range 4.94065E-324 to 1.79769E308 Useful when working with data that is non-integer and/or very large
Image of page 4
String Data Type A string is a segment of text and may include Upper and lower-case letters Punctuation marks Numbers Numbers assigned to a variable of type String cannot be used in calculations They will be viewed as text Strings are commonly used to name objects, label objects, and label data in spreadsheets 5
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Boolean Data Type A Boolean
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern