27 - IE 212 Computational Methods for Industrial...

• Notes
• 20

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

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
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

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
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

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

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

{[ snackBarMessage ]}

What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern