Skip to content

Instantly share code, notes, and snippets.

@tombrad
Created February 13, 2013 04:12
Show Gist options
  • Save tombrad/4942204 to your computer and use it in GitHub Desktop.
Save tombrad/4942204 to your computer and use it in GitHub Desktop.
Prototipos VBA-3-1
Private Sub ComboNombre_Click()
Rem al escoger un item del combobox hace lo siguiente
Rem coloca el costo en textbox1
saldo = 0
CodCliente = ComboNombre.ListIndex + 1
TextBox1.Text = Hoja1.Cells(CodCliente, 2)
Rem coloca el precio de venta (lista) en textbox2
TextBox2.Text = Hoja1.Cells(CodCliente, 3)
TextBox3.Text = Hoja1.Cells(CodCliente, 4)
ultimo = Hoja2.Cells(1, 1)
For z% = 2 To ultimo
If CodCliente = Hoja2.Cells(z%, 1) Then
monto = Hoja2.Cells(z%, 4)
If Hoja2.Cells(z%, 5) = "Debe" Then
monto = -1 * monto
End If
saldo = saldo + monto
End If
Next z%
TextBox4.Text = saldo
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment