Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• Data Types
• http://www.techonthenet.com/excel/
• http://www.functionx.com/vbaexcel/Les
son01.htm
Visual Basic for Applications
• VBA is a version of Visual Basic (VB)
available in most Microsoft (MS) Office
applications
row=startRow
Do
x=Cells(row,”A”).Value
y=Exp(x)*Sin(2*x)-3.25
Cells(row,”B”).Value=y
row=row+1
Loop Until row >(startRow+nRows)
For … Next Loop
Sub FillData(startRow,nRows)
Dim x as Double
Dim y as Double
For row=startRow to
(startRow+nRows)
x=Cells(row,”A”).Value
y=Exp(x)*Sin(2*x)-3.25
Cells(row,”B”).Value=y
The If...Then...ElseIf
Statement
If Condition1 is True Then
Statement1
ElseIf Condition2 is True Then
Statement2
ElseIf Conditionk is True Then
Statementk
End If
If Then …
Function MyFunction(x)
retVal=“N/A”
If x <10 Then
retVal=“Less Than 10”
ElseIf x<20
retVal=“10 to 20”
Else
retVal=“More Than 20”
End If
MyFunction=retVal
End Function
The Select Case Statement
Select Case Expression
Case Expression1
Statement1
Case Expression2
Statement2
Case Expressionk
Statementk
Case Else
Default statement
End Select