Beruflich Dokumente
Kultur Dokumente
N -1
b Dx
ò f ( x ) dx = å [ f ( x i ) + f ( x i +1 ) ]
a
i =1 2
Dx
= [ f ( a ) + ..... + 2 f ( x i -1 ) + 2 f ( x i ) + 2 f ( x i + 1 ) + ... + f ( b ) ]
2
N
b Dx
òa f ( x ) dx = å [w i f ( x i ) ]
i =1 3
Dx
= { f ( a ) + 4 f ( x 1 ) + 2 f ( x 2 ) + 4 f ( x 3 ) + 2 f ( x 4 ) + .....
3
+ 2 f ( x n -1 ) + 4 f ( x n -1 ) + f ( b )}
Rule #2: Changing the property of an object
Changing the property of an object
Range(“A4”).Value=25
Rule #3: Returning the current value of object property
Returning the current value of object property
cellValue=Range(“A4”).Value
Rule #4: Referring to the object’s Method
Referring to the object’s Method
Range(“A4”).ClearContents
Some Excel functions
PI(), Sqrt(value), countif, lookup,
FREQUENCY(data_array,bins_array)
Slope(yvalue,x_value), Intercept (y
value,x_value), Intercept (yvalue,x_value)
Linest and Logst
Some VB functions and Syntax:
Sqr(value)
If ( condition ) Then
( execution1 )
Else
( execution2 )
End If
Select case testexpression
[case expressionlist1
[statement] ]
[case expressionlist2
[statement] ]
[case else
[statement] ]
End select
For LoopIndex =startValue To endValue [Step Increment]
(body of loop)
Next [loopIndex]
Do
(body of loop)
Loop until (condition to stop the loop)
Exit loop, Exit do
ABS(x) Absolute value of x
eg. A = ABS(10)
10)
ATN(x) ArcTangent
TAN(x) Tangent x in RADIANS
If input of angles in degrees, then convert to
radians p
x = d
180
EXP(x) e to the power of x
e to the power of x
LOG(x) natural log.
SQR(x) square root
Some VB functions and Syntax (continue):
Some VB functions and Syntax (continue):
Function Description
InStr(string1, string2) Returns the position of string 1 within string2
Returns the position
LCase(string) Converts string
string to lowercase
Left(string, length) Returns a specified number of characters
Returns a specified number of characters(length) from
the left side of string
Len(string) Returns the number of characters in string
Returns the number of characters in
LTrim(string) Returns string without leading spaces
string
Mid(string, Start[,length]) Returns length characters from
length string, beginning at start
Right(string,length) Returns length characters from right side of
length string
RTrim(string) Returns string without trailing spaces
string
Space(number) Returns string consisting of number spaces
string
Str(number) Returns string representation of
string number
Trim(string) Returns string without leading and trailing spaces
string
UCase(string) Converts string
string to uppercase
Val(string) Returns the number contained in string as a numerical
Returns the number contained in
values
v = MsgBox prompt[,button][,title][,helpfile, context]
prompt Message in the dialog box
title Title in title bar of message box
button Number specifying the type of buttons to display
0 OK button only (default)
1 OK and Cancel
3 Yes, No and Cancel
v=InputBox(prompt[, title][,default])
prompt Message in the dialog box
title Title in title bar of message box
default string expression in the text box as the default response
DIM array_name ([min TO] max) as data_type
Open Pathname For mode As [#]filenumber
filenumber
Write #filenumber, [Outputlist]
Close #filenumber
Open Pathname For mode As [#]filenumber
filenumber
Input #filenumber, Varlist
Close #filenumber
EOF (filenumber)
Some VB functions and Syntax (continue):
IsNumeric(expression)
Format(8315.4, "00000.00") 08315.40
Format(8315.4, "#####.##") 8315.4
Format(8315.4, "Scientific") 8.31E+3
Control Default Property
Text Box Text
Command Buttons Value
Label Caption
Frame Caption
Check Box Value
Option Button Value
• Clearing Text Boxes and Labels (null String)
(null String)
• Resetting Focus (setFocus)
• Setting the Value Property
option Buttons/Check boxes
• Changing Font Property of Controls
Changing Font Property of Controls
(TxtName.Font.Bold=true, TxtName.Font.Size=12, etc)
• Changing Color of Text (txtname.foreColor =vbRed)
(txtname.foreColor =vbRed)
• Changing Multiproperty of a control
Changing Multiproperty of a control (With, End With)
• Concatenating Text (String1&Opbect.Text&string2...)
(String1&Opbect.Text&string2...)