Está en la página 1de 4

Sub primero()

Cells(1, 1) = "hola"
Cells(3, 3) = "hola como estas"
Cells(5, 3) = "curso de excel"

End Sub
Sub segundo()
Worksheets("hoja2").Select
Cells(2, 2) = "hola"
End Sub
Sub tercero()
Worksheets("presupuesto").Select
Cells(4, 3) = "buenas tardes"
End Sub
Sub cuarto()
For i = 1 To 5
Cells(i, 1) = "hola"
Next i

End Sub
Sub quinto()
For i = 1 To 5
MsgBox i
Next i
MsgBox "fin"

End Sub
Sub sexto()
For i = 3 To 5
MsgBox i
Next i
MsgBox "fin"

End Sub
Sub septimo()
Worksheets("hoja1").Select
Total = Val(InputBox("ingrese la cantidad de estudiantes"))
For i = 1 To Total
nombre = InputBox("ingrese nombre")
Cells(i, 1) = nombre
10:
nota1 = Val(InputBox("ingrese nota1"))
If nota1 >= 20 Or nota1 < 0 Then
MsgBox "error!!"
GoTo 10
End If
nota2 = Val(InputBox("ingrese nota 2"))
Cells(i, 2) = nota1
Cells(i, 3) = nota2
promedio = (nota1 + nota2) / 2
Cells(i, 4) = promedio
If promedio >= 10.5 Then
Cells(i, 5) = "aprobado"
Else
Cells(i, 5) = "desaprobado"
End If

Next i

End Sub
Sub octavo()
Worksheets("hoja1").Select
Total = Val(InputBox("ingrese la cantidad de estudiantes"))
For i = 1 To Total
nombre = InputBox("ingrese nombre")

Cells(i, 1) = nombre
nota1 = Val(InputBox("ingrese nota1"))
nota2 = Val(InputBox("ingrese nota 2"))
Cells(i, 2) = nota1
Cells(i, 3) = nota2
promedio = (nota1 + nota2) / 2
Cells(i, 4) = promedio
If promedio >= 10.5 Then
Cells(i, 5) = "aprobado"
Else
Cells(i, 5) = "desaprobado"

End If
Next i
End Sub
Sub noveno()
Worksheets("hoja2").Select
Total = Val(InputBox("ingrese la cantidad de trabajadores"))
For i = 1 To Total
nombre = InputBox("ingrese nombre")
Cells(i, 1) = nombre
dias = Val(InputBox("ingrese dias"))
jornal = Val(InputBox(" cuanto se le paga"))
Cells(i, 2) = dias
Cells(i, 3) = jornal
sueldo = dias * jornal
Cells(i, 4) = sueldo
If sueldo >= 300 Then
Cells(i, 5) = "renovado"
Else
Cells(i, 5) = "despedido"
End If

Next i

End Sub

También podría gustarte