
El Case con datos variables
Publicado por Miguel Campusano (16 intervenciones) el 19/11/2016 19:35:42
En este codigo el unico dato que dependera de la entrada humana es la n, pero los demas datos son variables, pero no me entra a las condiciones cuando n=z o cuando n=f
muchas gracia spor su ayuda
muchas gracia spor su ayuda
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
Private Sub CommandButton3_Click()
Dim i, n, z, f, P, HH, EE, MM As Integer
Dim r1, r2 As String
Dim b As Boolean
f = 5
HH = 0
EE = 0
MM = 0
If Cells(3, "A") <> "COD." Or Cells(4, "A") <> "Recursos Humanos" Then
MsgBox ("NO ESTAS EN UN ANALISIS DE COSTO")
GoTo d
End If
While Cells(f, "A") <> "Recursos Equipos" 'Averiguar # de Recursos Equipos en Analisis de Costos
f = f + 1
HH = HH + 1
Wend
f = HH + 5 + 1
While Cells(f, "A") <> "Recursos Materiales" 'Averiguar # de Recursos Humanos en Analisis de Costos
f = f + 1
EE = EE + 1
Wend
f = 5 + EE + 1 + HH
While Cells(f, "g") <> "ITBIS RREE & RRMM=>" 'Averiguar # de Recursos Materiales en Analisis de Costos
f = f + 1
MM = MM + 1
Wend
n = InputBox("Escoja la linea del Recurso a Eliminar ", "ELIMINACION DE RECURSO")
MM = MM - 1
z = (5 + HH)
f = (5 + EE + HH + 1)
i = (5 + HH + EE + MM + 1)
P = i + 3
MsgBox ("Z =" & z)
MsgBox ("F =" & f)
MsgBox ("I =" & i)
MsgBox ("P =" & P)
MsgBox ("n =" & n)
Select Case n
Case 0 To 4
MsgBox ("LINEAS DE ENCABEZADO, NO PUEDEN SER ELIMINADA")
Unload UserForm1
Case z: 'al z y al f no me entra la sentencia cuando n es igual a z o a f no cumple sus condiciones
MsgBox ("ETIQUETA RECURSO EQUIPO, NO PUEDEN SER ELIMINADA")
Unload UserForm1
Case f:
MsgBox ("ETIQUETA RECURSO MATERIALES, NO PUEDEN SER ELIMINADA")
Unload UserForm1
Case i To P
MsgBox ("RESULTADOS DE ANALISIS DE COSTOS, NO PUEDEN SER ELIMINADA")
Unload UserForm1
Case Else
Rows(n & ":" & n).Select
Selection.Delete Shift:=xlUp
End Select
d:
End Sub
Valora esta pregunta


0