Professional Documents
Culture Documents
Anotações Programação P1 - Videos
Anotações Programação P1 - Videos
Elisa: Variable
= assigns a value to variable
1997: value (value of the variable 1997)
Cells(x,y) = Elisa
Elisa = “Bannwart”
Elisa: Variable
= assigns value of the variable
“Bannwart”: value is text “Bannwart”
Concatenated:
- Use +
- Junta duas coisas
- Eg: 3 + 3 = 33
Option Explicit:
- This ensures all variables must be defined
- This is performed by a DIM statement
Dim:
- Integer:
o
- String
Sub yellowLoop()
colNum = 3
For rowNum = 2 To 5
'-----------------------------
'Set back to yellow
'-----------------------------
'This assigns a value to the
'ColorIndex property of the
'Interior property of the
'Excel cell at row equal to
'the value of variable rowNul,
'column equal to the value
'of variable colNum.
'The value is the number 6
Cells(rowNum, colNum).Interior.ColorIndex = 6
colNum = colNum + 3
Next rowNum
End Sub
Sub yellowLoop()
colNum = 3
For rowNum = 2 To 5
Cells(rowNum, colNum).Interior.ColorIndex = 6
colNum = colNum + 3
Next rowNum
End Sub
Sub redLoop()
'Initialise colNum
colNum = 13
For rowNum = 12 To 15
Cells(rowNum, colNum).Interior.ColorIndex = 3
colNum = colNum - 1
Next rowNum
End Sub
colNum = 3
For rowNum = 15 To 19
If rowNum = 15 Then
End If
Cells(rowNum, colNum).Interior.ColorIndex = 3
colNum = colNum + 3
Next rowNum
Pintar de azul as celulas pulando 5 linhas 2 colunas (linha 9-19; coluna 3-7)
Sub blueLoop()
For rowNum = 9 To 19 Step 5
Next rowNum
End Sub
'ColorIndex values:
' 0 = none
' 1 = black
' 2 = white
' 3 = red
' 4 = green
' 5 = blue
' 6 = yellow
3) Loops - 4 of them
sub blackLoop()
End Sub