Você está na página 1de 3

GUIA PARA CALCULAR EL VALOR DE LAS EXTRAS

Usted puede realizar un formulario con visual basic, para calcular el valor de las horas extras

Usted ve el botón y encontrara el código de programación que lleva cada botón

Sheets("hoja2").Select
Range("a2").Select
ActiveCell.FormulaR1C1 = a

Sheets("hoja2").Select
Range("b2").Select
ActiveCell.FormulaR1C1 = b

Sheets("hoja2").Select
Range("c2").Select
ActiveCell.FormulaR1C1 = ComboBox1

Sheets("hoja2").Select
Range("d2").Select
ActiveCell.FormulaR1C1 = c

Página 1
‘En este botón encontrara el funcionamiento de la estructura case

Private Sub btnejecutar_Click()


Select Case ComboBox1
Case "HED"
c = Val(a) / 240 * b * 1.25
Case "HEN"
c = Val(a) / 240 * b * 1.75
Case "HER"
c = Val(a) / 240 * b * 0.35
Case "HEF"
c = Val(a) / 240 * b * 2
Case "HEFD"
c = Val(a) / 240 * b * 2.25
Case "HEFN"
c = Val(a) / 240 * b * 2.75
Case Else
c=0
End Select
Sheets("hoja2").Select
Selection.EntireRow.Insert
End Sub

Private Sub btnlimpiar_Click()


a = Empty
b = Empty
c = Empty
ComboBox1 = Empty
a.SetFocus
End Sub

Private Sub btnsalir_Click()


Me.Hide
End Sub

El código de programación del combobox1


Es necesario del siguiente procedimiento

Private Sub UserForm_Initialize()


For h = 1 To 7
If h = 1 Then
hora = "HED"
End If

Página 2
If h = 2 Then
hora = "HEN"
End If
If h = 3 Then
hora = "HER"
End If
If h = 4 Then
hora = "HEF"
End If
If h = 5 Then
hora = "HEFD"
End If
If h = 6 Then
hora = "HEFN"
End If
If h = 7 Then
hora = "HERF"
End If
ComboBox1.AddItem (hora)
Next
End Sub

Página 3

Você também pode gostar