Está en la página 1de 4

Sentencias de Control

1. De Bifurcación
If … then ... else
Select ... Case
2. De Repetición
While
For
For each
3. De ejecución múltiple sobre un objeto
With

La Sentencia IF
1ra Forma:
If Condición then Instrucción
2da Forma:
If Condición then Instrucción1 else Instrucción2
3ra Forma:
If Condición then
Instrucción
Instrucción
Instrucción
End If
4ta Forma:
If Condición then
Instrucción
Instrucción
Instrucción
Else
Instrucción
Instrucción
End If

La Sentencia Select Case


Select Case Expresion_prueba
Case Expresión1
Instrucción
Case Expresión2
Instrucción
…….
Case Else
Instrucción
End Select

La Sentencia While
While Condición
Instrucción
Instrucción
Instrucción
Wend

La Sentencia For
For N=1 to 3 N=1
Instrucción N=2
Instrucción N=3
Instrucción N=4
Next

La Sentencia For each


For each Elemento in Colección
Instrucción
Instrucción
Instrucción
Next

Colecciones de Excel
Range("A4:A10") : Todas las celdas de un rango
Cells : Todas las celdas de la hoja actual
Worksheets : Todoas las hojas del libro actual
Workbooks : Todos los libros abiertos
Charts : Todos los gráficos
Shapes : Todas las figuras o formas

Para dar color a un Objeto


Range("B4").interior.colorindex=3 (3: rojo)
Range("B4").Font.colorindex=4 (4: verde) Lima
Range("B4").Borders.colorindex=4 (5: azul)
Catálogo ColorIndex
N° Color N° Color N° Color N° Color
0 0 21 42
1 1 22 43
2 2 23 44
3 3 24 45
4 4 25 46
5 5 26 47
6 6 27 48
7 7 28 49
8 8 29 50
9 9 30 51
10 10 31 52
11 11 32 53
12 12 33 54
13 13 34 55
14 14 35 56
15 15 36
16 16 37
17 17 38
18 18 39
19 19 40
20 20 41
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

También podría gustarte