Entradas

Unidad 4 Actividades

PROGRAMA 1   Option Explicit Sub pregunta() Dim var1, var2 As Integer var1 = 5 var2 = 8 If var1 > var2 Then MsgBox ("si es mayor") Else: MsgBox ("no es mayor") End If End Sub PROGRAMA 2 Sub pregunta2() Dim lug As Integer lug = InputBox("lugar de llegada:") If lug = 1 Then MsgBox ("ganaste") End Sub PROGRAMA 3 If lug = 2 Then MsgBox ("segundo") If lug = 3 Then MsgBox ("tercero") End Sub If lug = 4 Then MsgBox ("gracias por participar") End If End Sub PROGRAMA 4 Sub pregunta3() Dim num As Integer num = InputBox("dame lugar:") If num = 1 Then MsgBox ("ganador") Else: If num = 2 Then MsgBox ("segundo") Else: If num = 3 Then  MsgBox ("tercero")  Else:  MsgBox ("gracias por participar") End If End If End If End Sub PROGRAMA 5 Sub pregunta4() Dim n As Integer n = InputBox("dame lugar:") If n = 1 Then MsgBox ("ganador") ElseIf n = 2 Then MsgBox ("s...

Unidad 3 Actividades

PROGRAMA 1 Sub entrada() Dim nom As String nom = Application.InputBox("dame un nombre") Range("A8") = nom End Sub PROGRAMA 2 Sub entrada2() Range("a1") = "indice" Range("b1") = "contenido" Dim i As Integer For i = 1 To 5   Cells(i + 1, 1) = i Next i For i = 1 To 5   Cells(i + 1, 2) = Application.InputBox("nombre") Next i End Sub PROGRAMA 3 Sub entrada3() Range("a8") = "indice" Range("b8") = "numero" Dim i As Integer For i = 8 To 12   Cells(i + 1, 2) = i Next i For i = 8 To 12   Cells(i + 1, 2) = Application.InputBox("datos") Next i End Sub PROGRAMA 4 Option Explicit Sub ej_unir() Dim cadena As String Dim arrcad(1 To 3) As String Dim i As Integer For i = 1 To 3 arrcad(i) = InputBox(i & "dame tu nombre:") Next i cadena = Join(arrcad, "-") Range("a1") = cadena End Sub PROGRAMA 5 Sub ej_dsepara() Dim i As Integer Dim cad As String Dim vec...
UNIDAD 2 Actividades PROGRAMA1 Const var = 123 'constante y global Sub ejemplo1() 'comentario 'comentario mas extenso MsgBox ("Hola") End Sub PROGRAMA 2 Sub ejemplo2() Dim numero As Integer numero = 5 Cells(1, 1) = numero Cells(2, 1) = var End Sub PROGRAMA 3 Sub ejemplo3() Dim a, b, c As Integer Dim nom As String nom = "Emiliano" a = 7 b = 9 c = 2 Cells(1, 1) = a Cells(1, 2) = b Cells(1, 3) = c Cells(1, 4) = var End Sub PROGRAMA 4 Sub ejemplo4() 'constante publica Public Const var = "hola" 'constante privada Private Const var1 = "mundo" 'declarar en la misma linea Const cad = "hola", vard As Double = 3.14567 End Sub PROGRAMA 5 Option Explicit Sub suma()    Dim var As Byte    var = 15 + 5    Cells(1, 1) = "suma de 15 y 5"    Cells(2, 1) = var     End Sub PROGRAMA 6 Sub resta() Dim varr As Byte varr = 15 - 5 Cells(1, 2) = "resta de 15-5" Cells(2, 2) = varr End Sub PROGRAMA 7 Sub multiplicasion()...