{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

LanguageFundamentals_07

# LanguageFundamentals_07 - Language Fundamentals VBA...

This preview shows pages 1–12. Sign up to view the full content.

March 07 CEE 3804 Faculty 1 Language Fundamentals VBA Concepts Chapra’s Chapters 7 and 8

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

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

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

View Full Document
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
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

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

View Full Document
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
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

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

View Full Document
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
Double Precision Numbers 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

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

View Full Document
Currency This data type is designed specifically to store financial information Currency values are in fixed-point format with up to 15 digits before the decimal and 4 digits after the decimal point The range of numbers is from 922,337,203,685,477.5805, to +922,337,203,685,477.5807
Strings There are two types of stings: variable length fixed length In a variable length string, the stored string can be of any length (up to 65,500 characters) Sequence of alphanumeric characters enclosed by double quotation marks “What is your name?” “Enter yield strength of steel”

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 76

LanguageFundamentals_07 - Language Fundamentals VBA...

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

View Full Document
Ask a homework question - tutors are online