Skip to content

Instantly share code, notes, and snippets.

View tombrad's full-sized avatar

Tomas Bradanovic tombrad

View GitHub Profile
@tombrad
tombrad / gist:4971574
Created February 17, 2013 13:52
test 3
hrs = raw_input("Enter Hours:")
hors=float(hrs)
rate = raw_input("Enter Rate:")
rate1=float(rate)
total=hors*rate1
print type(hors), type(rate1), type (total)
print total
@tombrad
tombrad / gist:4961459
Created February 15, 2013 16:22
Max and min initializing with None
max = None
min= None
while True:
num = raw_input("Enter a number: ")
if num == "done" : break
if len(num)<1 : break
try:
num = float(num)
except :
print "Invalid input"
@tombrad
tombrad / gist:4942238
Created February 13, 2013 04:21
Prototipos VBA-3-11
Private Sub UserForm_Activate()
If Hoja1.Cells(1, 1) &lt;&gt; "" Then
For z = 1 To 500
ComboBox1.AddItem Hoja1.Cells(z, 1)
Next z
Rem deja en blanco el combo
ComboBox1.Text = ""
End If
End Sub
@tombrad
tombrad / gist:4942233
Created February 13, 2013 04:20
Prototipos VBA-3-10
Private Sub ComboBox1_Click()
Hoja3.Activate
ultimo = Hoja2.Cells(1, 1)
linea = 1
For z% = 2 To ultimo
indice = z%
CodCliente = ComboBox1.ListIndex + 1
If CodCliente = Hoja2.Cells(z%, 1) Then
monto = Hoja2.Cells(z%, 4)
If Hoja2.Cells(z%, 5) = "Debe" Then
@tombrad
tombrad / gist:4942232
Created February 13, 2013 04:19
Prototipos VBA-3-9
Private Sub CommandButton1_Click()
Rem posicion del indice en la celda 1,1
indice = Hoja1.Cells(1, 1)
Rem si el indice es cero se cambia a uno
If indice = "" Then
indice = 1
Hoja1.Cells(1, 1) = indice
End If
Rem incrementa el indice en 1 lugar que es la fila donde debe grabar
indice = indice + 1
@tombrad
tombrad / gist:4942229
Created February 13, 2013 04:18
Prototipos VBA-3-8
Private Sub UserForm_Activate()
ComboBox1.AddItem "Haber"
ComboBox1.AddItem "Debe"
ComboBox1.Text = ComboBox1.List(1)
TextBox1.Text = Date
ComboBox2.SetFocus
If Hoja1.Cells(1, 1) &lt;&gt; "" Then
For z = 1 To 500
ComboBox2.AddItem Hoja1.Cells(z, 1)
Next z
@tombrad
tombrad / gist:4942225
Created February 13, 2013 04:18
Prototipos VBA-3-7
Private Sub CommandButton1_Click()
Rem posicion del indice en la celda 1,1
indice = Hoja2.Cells(1, 1)
Rem si el indice es cero se cambia a uno
If indice = "" Then
indice = 1
Hoja2.Cells(1, 1) = indice
End If
Rem incrementa el indice en 1 lugar que es la fila donde debe grabar
indice = indice + 1
@tombrad
tombrad / gist:4942224
Created February 13, 2013 04:17
Prototipos VBA-3-6
Private Sub UserForm_Activate()
Rem llena los valores del combo cada vez que parte el programa userform_activate
Rem para ello primero parte de la posicion 2
Rem y cambia los valores de z desde 1 a 500
Rem y con el metodo additem llena al combo de valores (nombres de articulos)
If Hoja1.Cells(1, 1) &lt;&gt; "" Then
For z = 1 To 500
ComboNombre.AddItem Hoja1.Cells(z, 1)
Next z
Rem deja en blanco el combo
@tombrad
tombrad / gist:4942222
Created February 13, 2013 04:15
Prototipos VBA-3-5
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Rem calcula el total de la venta y lo coloca en textbox4.text
TextBox4.Text = TextBox2.Text * TextBox3.Text
End Sub
@tombrad
tombrad / gist:4942216
Created February 13, 2013 04:15
Prototipos VBA-3-4
Private Sub CommandButton4_Click()
Rem para emitir cartola
Rem se carga userform4
Load UserForm4
Rem se muestra userforrm4
UserForm4.Show
End Sub