Você está na página 1de 7

Private Sub ComboBox1_Change()

If ComboBox1 = "" Then

TextBox1 = Empty

ComboBox1.MatchRequired = False 'Acepta que se deje vacía la casilla de RAQUETA.

TextBox1.BackColor = RGB(216, 216, 216)

Exit Sub

End If

ComboBox1.MatchRequired = True 'Obliga a seleccionar un dato correcto de la lista

If ComboBox1.MatchFound = False Then 'No permite digitar ningun texto

ComboBox1 = Empty

End If

If ComboBox1.MatchRequired = True Then 'Si se selecciona un dato correcto

TextBox1.BackColor = RGB(255, 255, 255)

If ComboBox1 = "BABOLAT PURE DRIVE" Then

TextBox1.Value = 450000

End If

If ComboBox1 = "WILSON BLX" Then

TextBox1.Value = 400000

End If

If ComboBox1 = "HEAD ULTIMATE SPEED" Then

TextBox1.Value = 350000
End If

If ComboBox1 = "DUNLOP FORCE TOUR" Then

TextBox1.Value = 250000

End If

If ComboBox1 = "YONEX VCORE SV" Then

TextBox1.Value = 230000

End If

If ComboBox1 = "PRINCE CLASSIC" Then

TextBox1.Value = 180000

End If

End If

End Sub

Private Sub CommandButton1_Click()

Dim PESO, ENCORDADO, GRIP, ANTIVIBRADOR, THERMOBAG As Single

Dim RAQUETA, subtotal, iva, neto As Single

'*** Para calcular el valor del PESO ***

If OptionButton1 = True Then 'Peso de 320 gr

PESO = 80000

End If

If OptionButton2 = True Then 'Peso de 280 gr


PESO = 50000

End If

If OptionButton3 = True Then 'Peso de 220 gr

PESO = 40000

End If

'*** Para calcular el valor de los ACCESORIOS ***

If CheckBox1 = True Then

ENCORDADO = 25500

End If

If CheckBox2 = True Then

GRIP = 5000

End If

If CheckBox3 = True Then

ANTIVIBRADOR = 10000

End If

If CheckBox4 = True Then

THERMOBAG = 320000

End If

If TextBox1 = "" Then


MsgBox "No ha escogido una raqueta", vbCritical, "COTIZACIÓN DE RAQUETA"

ComboBox1.SetFocus

Exit Sub

End If

'*** Se calcula el Subtotal ****

TextBox2.BackColor = RGB(255, 255, 255)

procesador = TextBox1.Value

subtotal = RAQUETA + PESO + ENCORDADO + GRIP + ANTIVIBRADOR + THERMOBAG

TextBox2.Value = subtotal

'***Se calcula el valor del IVA ***

TextBox3.BackColor = RGB(255, 255, 255)

iva = subtotal * 0.16

TextBox3.Value = iva

'***Se calcula el Neto a pagar ***

TextBox4.BackColor = RGB(255, 255, 255)

neto = subtotal + iva

TextBox4.Value = neto

End Sub

Private Sub CommandButton2_Click()

ComboBox1 = Empty
TextBox1 = Empty

TextBox2 = Empty

TextBox3 = Empty

TextBox4 = Empty

OptionButton1 = False

OptionButton2 = False

OptionButton3 = False

CheckBox1 = False

CheckBox2 = False

CheckBox3 = False

CheckBox4 = False

TextBox1.BackColor = RGB(216, 216, 216)

TextBox2.BackColor = RGB(216, 216, 216)

TextBox3.BackColor = RGB(216, 216, 216)

TextBox4.BackColor = RGB(216, 216, 216)

ComboBox1.SetFocus

ComboBox1.MatchRequired = False 'Acepta que se deje vacía la casilla de RAQUETA

End Sub

Private Sub CommandButton3_Click()

rta = MsgBox("Desea salir?", vbYesNoCancel, "Salir del programa")

If rta = vbYes Then

End

Else

ComboBox1 = Empty
TextBox1 = Empty

TextBox2 = Empty

TextBox3 = Empty

TextBox4 = Empty

OptionButton1 = False

OptionButton2 = False

OptionButton3 = False

CheckBox1 = False

CheckBox2 = False

CheckBox3 = False

CheckBox4 = False

TextBox1.BackColor = RGB(216, 216, 216)

TextBox2.BackColor = RGB(216, 216, 216)

TextBox3.BackColor = RGB(216, 216, 216)

TextBox4.BackColor = RGB(216, 216, 216)

ComboBox1.SetFocus

ComboBox1.MatchRequired = False 'Acepta que se deje vacía la casilla de RAQUETA

End If

End Sub

Private Sub TextBox1_Change()

TextBox1 = Format(TextBox1, "#,##0") 'Le da formato numérico a la caja de texto

End Sub

Private Sub TextBox2_Change()


TextBox2 = Format(TextBox2, "#,##0") 'Le da formato numérico a la caja de texto

End Sub

Private Sub TextBox3_Change()

TextBox3 = Format(TextBox3, "#,##0") 'Le da formato numérico a la caja de texto

End Sub

Private Sub TextBox4_Change()

TextBox4 = Format(TextBox4, "#,##0") 'Le da formato numérico a la caja de texto

End Sub

Private Sub UserForm_Activate() 'Rellena de color gris los siguientes controles

TextBox1.BackColor = RGB(216, 216, 216)

TextBox2.BackColor = RGB(216, 216, 216)

TextBox3.BackColor = RGB(216, 216, 216)

TextBox4.BackColor = RGB(216, 216, 216)

End Sub

Você também pode gostar