Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hola me pueden ayudar visual basic

115 views
Skip to first unread message

nogaj...@gmail.com

unread,
Nov 27, 2016, 1:31:46 AM11/27/16
to
estoy haciendo un inventario y no puedo hacer q los movimientos de entradas y salidas de mercaderia queden registrado en la tabla , cuando pincho el boton de entrada , la cantidad se ingresa en la salida y cuando pincho la salida se suma a la anterior

esto es lo q tengo hecho en excel




CODIGO PRODUCTO FECHA CANTIDAD MOVIMIENTO



PRODUCTO



CODIGO PRODUCTO ENTRADAS SALIDAS SALDO
10 ACEITE VEGETAL BELMONT
20 DETERGENTE POLVO ARIEL
30 FIDEOS CAROZZI 5un + 1
40 SALSA DE TOMATE ITALIANA
50 DURAZNO MITADES LO MEJOR
60 ARVERJITA FINA LA HORTELANA
70 JUREL NATURAL GRUMETE
80 ATUN LOMITO CRUCERO
90 JABON BARRA ANTIBACTERIAL
100 BALSAMO MIXTO SACHET BALLE
110 PILAS ZINC CARBON GR SONY
120 PILAS ZINC CARBON MED SONY
130 LIMPIADOR LIQ POETT
140 TOALLA PAPEL 1 ROLLO MINI ABOLENGO
150 PAPEL HIG 4rll HOJA SIMPRE ORQUI
160 PAPEL HIG D/H 4rll ACOLCHADO
170 ENCENDEDOR TRANSPARENTE RED POWER
180 PAÑUELO DISPLEY FAVORITA
190 SALSA TOMATE ITA SACHET DOÑA CLARA
200 PASTA DENTAL WHITENING PEPS


y esto es mi visual basic



Sub proceso()

Dim ultlinea As Long
Dim ultlineadatos As Long
Dim codigo, producto, fecha, cantidad, movimiento As String
Dim busquedafiladatos As Range
Dim rangobusqueda As String
Dim filaregistro As Long

'validar q la informacion este completamente dilengenciada
codigo = Sheets("almacen").Cells(5, 1)
producto = Sheets("almacen").Cells(5, 2)
fecha = Sheets("almacen").Cells(5, 3)
cantidad = Sheets("almacen").Cells(5, 4)
movimiento = Sheets("almacen").Cells(5, 5)

If Len(codigo) = 0 Or Len(producto) = 0 Or Len(fecha) = 0 Or Len(cantidad) = 0 Or Len(movimiento) = 0 Then
MsgBox "debe ingresar todos los campos!", vbCritical, "resultado"
Exit Sub

End If

'asignacion de valores en movimientos
ultlinea = Sheets("almacen").Range("H" & Rows.Count).End(xlUp).Row

Sheets("almacen").Cells(ultlinea + 1, 8) = codigo
Sheets("almacen").Cells(ultlinea + 1, 9) = producto
Sheets("almacen").Cells(ultlinea + 1, 10) = fecha
Sheets("almacen").Cells(ultlinea + 1, 11) = cantidad
Sheets("almacen").Cells(ultlinea + 1, 12) = movimiento

'actualizar entradas y salidas
ultlineadatos = Sheets("almacen").Range("A" & Rows.Count).End(xlUp).Row
rangobusqueda = "A12:A" & ultlineadatos

Set busquedafiladatos = Sheets("almacen").Range(rangobusqueda).Find(codigo, lookat:=xlWhole)

If busquedafiladatos Is Nothing Then
MsgBox "el codigo ingresado no existe", vbCritical, "resultado"
Exit Sub

Else
filaregistro = busquedafiladatos.Row

If movimiento = "Entradas" Then
Sheets("almacen").Cells(filaregistro, 3) = Sheets("almacen").Cells(filaregistro, 3) + cantidad
Else
Sheets("almacen").Cells(filaregistro, 4) = Sheets("almacen").Cells(filaregistro, 4) + cantidad
End If

Sheets("almacen").Cells(filaregistro, 5) = Sheets("almacen").Cells(filaregistro, 3) - Sheets("almacen").Cells(filaregistro, 4)


'limpiar datos
Sheets("almacen").Cells(5, 1) = ""
Sheets("almacen").Cells(5, 3) = ""
Sheets("almacen").Cells(5, 4) = ""
Sheets("almacen").Cells(5, 5) = ""

MsgBox "actualizacion exitosa de la informacio de E/S", vbInformation, "resultado"
Sheets("almacen").Range("A5").Select

End If


End Sub









0 new messages