You are on page 1of 4

Esto es el ejercicio 2 es de viasul

Private Sub txtregistrar_Click()

Dim codigo As Integer

Dim articulo As String

Dim unid As Integer, cant As Integer

Dim preciouni As Currency, subtotal As Currency, descuento As Currency, total As Currency

Worksheets("formulario").Activate

Range("b6").Activate

codigo = txtcodigo

articulo = txtarticulo

unid = txtund

cant = txtcantidad

preciouni = txtprecio

Do While Not IsEmpty(ActiveCell)

ActiveCell.Offset(1, 0).Select

Loop

ActiveCell.Offset(0, 0) = codigo

ActiveCell.Offset(0, 1) = articulo

ActiveCell.Offset(0, 2) = unid

ActiveCell.Offset(0, 3) = cant

ActiveCell.Offset(0, 4) = preciouni

subtotal = cant * preciouni


ActiveCell.Offset(0, 5) = subtotal

descuento = 0.1 * subtotal

ActiveCell.Offset(0, 6) = descuento

total = subtotal - descuento

ActiveCell.Offset(0, 7) = total

txtcodigo = ""

txtarticulo = ""

txtund = ""

txtcantidad = ""

txtprecio = ""

txtcodigo.SetFocus

End Sub

Private Sub txtsalir_Click()

If MsgBox("Desea Salir?", vbQuestion + vbYesNo) = vbYes Then

End Sub

Private Sub UserForm_Click()

End Sub
Ejercicio 1

Private Sub cmdinsertar_Click()

Dim nombre As String

Dim dias As Integer

Dim pago As Currency,

bono As Currency,

sueldo As Currency

Worksheets("Registro").Activate

Range("A9").Activate

nombre = txtnombre

dias = txtdias

pago = txtpago

bono = txtbono

Do While Not IsEmpty(ActiveCell)

ActiveCell.Offset(1, 0).Select

Loop

ActiveCell.Offset(0, 0) = nombre

ActiveCell.Offset(0, 1) = dias

ActiveCell.Offset(0, 2) = pago

ActiveCell.Offset(0, 3) = bono

sueldo = dias * pago + bono

ActiveCell.Offset(0, 4) = sueldo

txtsueldo = sueldo
txtnombre.SetFocus

End Sub

Private Sub cmdlimpiar_Click()

txtnombre = ""

txtdias = ""

txtpago = ""

txtbono = ""

txtsueldo = ""

txtnombre.SetFocus

End Sub

Private Sub cmdsalir_Click()

If MsgBox("Desea Salir?", vbQuestion + vbYesNo) = vbYes Then

End

End If

End Sub

You might also like