LanguageFundamentals_07

LanguageFundamentals_07 - Language Fundamentals VBA...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
March 07 CEE 3804 Faculty 1 Language Fundamentals VBA Concepts Chapra’s Chapters 7 and 8
Background image of page 1

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

View Full DocumentRight Arrow Icon
Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines
Background image of page 2
Data Types 1. Numeric Integer Long integer Single-precision Double-precision Currency 2. Character Strings Variable length Fixed length 3. Variant in VBA
Background image of page 3

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

View Full DocumentRight Arrow Icon
Numeric Data Types, VBA Integers in VBA, Short in VB* Two bytes 32,767 to -32,768 Long Integers in VBA, Integers in VB* Four bytes 2,147,483,647 to -2,147,483,648 Single Precision Four bytes -3.402833E+38 to -1.40129E-45 negative 1.40129E-45 to 3.402823E+32 positive Double Precision Eight bytes -1.7977E+308 to -4.9407E-324 negative 4.9407E-324 to 1.7977E+308 positive * Integer types in VB are larger than same named types in VBA
Background image of page 4
Integers Integers are whole numbers They may be either positive or negative The range of VBA integers is -32767 to +32787 If the number if positive it is not necessary to put a + sign in front of the number You cannot use commas to separate groups of digits in an integer Examples of valid integers are: 1234 -13550 1667 -340 15 -30000 -5002 221 Examples of invalid integers are: -50000 35000 3,456 3.123
Background image of page 5

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

View Full DocumentRight Arrow Icon
Long Integers A long integer can hold a whole number but it can store a larger range of values VBA uses “Long” for this data type, VB uses “Integer” The range of values that can be stored in a long integer is -2,147,483,648 to +2,147,483,648 To declare a long integer variable you use the following declaration statement DIM x as Long Examples of some long integer constants are the following 32895 65483 -68957 56658 -1236978 58960321
Background image of page 6
Single Precision A real number is a number which contains a decimal point. In Basic real numbers can be represented as single precision numbers or as double precision numbers Real numbers cannot be represented in a computer exactly - only approximately Single precision numbers are accurate to the first seven digits 4 bytes of storage space
Background image of page 7

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

View Full DocumentRight Arrow Icon
Single Precision Numbers Single precision numbers can be written using fixed point notation or exponential notation The range of single precision numbers is from approximately -3.4E+38 to +3.4E+38 Examples of single precision numbers are: 102.3 0.00034 5678.90 10.5e-3 100E10 -5.67e-35 22! -35! 12.4e-27
Background image of page 8
Double precision numbers are accurate to 15 or 16 digits 8 bytes of storage space The range of double precision numbers is from approximately -1.8D+308 to +1.8D-308 The letter D is used to represent the exponent (instead of the letter E) Examples of double precision numbers are: 12345.6789012345 0.000012345036953 10.24D-300 12.687D+300
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/01/2012 for the course CEE 3804 taught by Professor Aatrani during the Spring '07 term at Virginia Tech.

Page1 / 76

LanguageFundamentals_07 - Language Fundamentals VBA...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online