Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Private Sub ComboBox1_Change()

If ComboBox1 = "" Then

TextBox1 = Empty

ComboBox1.MatchRequired = False 'Acepta que se deje vacía la casilla del ARTICULO.

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 = "CAMISA" Then

TextBox1.Value = 119000

End If

If ComboBox1 = "PANTALON" Then

TextBox1.Value = 219000

End If

If ComboBox1 = "CHAQUETA" Then

TextBox1.Value = 249000
End If

If ComboBox1 = "BOLSO" Then

TextBox1.Value = 249000

End If

End If

End Sub

Private Sub CommandButton1_Click()

Dim TALLA, CINTURON, ARETES, COLLAR, PULSERA As Single

Dim ARTICULO, subtotal, iva, neto As Single

'*** Para calcular el valor del Disco Duro ***

If OptionButton1 = True Then ' TALLA S

TALLA = 17800

End If

If OptionButton2 = True Then 'TALLA M

TALLA = 21900

End If

If OptionButton3 = True Then 'TALLA L

TALLA = 22900

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

If CheckBox1 = True Then

CINTURON = 42900

End If

If CheckBox2 = True Then

ARETES = 89900

End If

If CheckBox3 = True Then

COLLAR = 85000

End If

If CheckBox4 = True Then

PULSERA = 198000

End If

If TextBox1 = "" Then

MsgBox "No ha escogido un ARTICULO", vbCritical, "COTIZACIÓN DE ARTICULOS"

ComboBox1.SetFocus

Exit Sub

End If

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

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


procesador = TextBox1.Value

subtotal = ARTICULO + TALLA + CINTURON + ARETES + COLLAR + PULSERA

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 del ARTICULO

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 del ARTICULO.

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

You might also like