ciclo for
Publicado por mauricio (19 intervenciones) el 20/07/2020 22:20:28
tengo el siguiente codigo: para la fila 6 y 7 lo que requiero hacer es poder recorrer las filas sin ir copiando el código nuevamente como en el ejemplo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
57
58
59
60
61
'FILA 6
If Range("e6") = 1 And IsEmpty(Range("f6").Value) = True And IsEmpty(Range("g6").Value) = True And IsEmpty(Range("h6").Value) = True Then
Range("F6").Select
ActiveCell.FormulaR1C1 = "3"
Range("G6").Select
ActiveCell.FormulaR1C1 = "2"
Range("H6").Select
ActiveCell.FormulaR1C1 = "1"
ElseIf Range("e6") = 2 And Range("f6") = Empty And Range("g6") = Empty And Range("h6") = Empty Then
Range("F6").Select
ActiveCell.FormulaR1C1 = "1"
Range("G6").Select
ActiveCell.FormulaR1C1 = "3"
Range("H6").Select
ActiveCell.FormulaR1C1 = "2"
ElseIf Range("e6") = 3 And Range("f6") = Empty And Range("g6") = Empty And Range("h6") = Empty Then
Range("F6").Select
ActiveCell.FormulaR1C1 = "2"
Range("G6").Select
ActiveCell.FormulaR1C1 = "1"
Range("H6").Select
ActiveCell.FormulaR1C1 = "3"
End If
'FILA 7
If Range("e7") = 1 And IsEmpty(Range("f7").Value) = True And IsEmpty(Range("g7").Value) = True And IsEmpty(Range("h7").Value) = True Then
Range("F7").Select
ActiveCell.FormulaR1C1 = "3"
Range("G7").Select
ActiveCell.FormulaR1C1 = "2"
Range("H7").Select
ActiveCell.FormulaR1C1 = "1"
ElseIf Range("e7") = 2 And Range("f7") = Empty And Range("g7") = Empty And Range("h7") = Empty Then
Range("F7").Select
ActiveCell.FormulaR1C1 = "1"
Range("G7").Select
ActiveCell.FormulaR1C1 = "3"
Range("H7").Select
ActiveCell.FormulaR1C1 = "2"
ElseIf Range("e7") = 3 And Range("f7") = Empty And Range("g7") = Empty And Range("h7") = Empty Then
Range("F7").Select
ActiveCell.FormulaR1C1 = "2"
Range("G7").Select
ActiveCell.FormulaR1C1 = "1"
Range("H7").Select
ActiveCell.FormulaR1C1 = "3"
End If
Valora esta pregunta


0