Como restaurar valores eliminados de stock
Para Dante Amor
Buenas Dan!
Sabes que en ayuda que prestaste con el tema anterior de rebajar stock "Como restar stock empezando por la mayor cantidad"
Debo tener otro botón que recupere los valores que se descontaron...
Esta este codigo con el que descuenta desde el valor al mayor
Private Sub CommandButton14_Click() 'On Error Resume Next Application.ScreenUpdating = True If TextBoxCantidad_Reb = "" Or TextBoxCantidad_Reb = 0 Then MsgBox ("Ingrese cantidad mayor a cero") TextBoxCantidad_Reb = "" TextBoxCantidad_Reb.SetFocus Exit Sub End If ' If ListBox2.ListCount = 0 Then MsgBox "No hay registro en el list" TextBoxCantidad_Reb.SetFocus Exit Sub End If ' If ComboBoxCodigo_Reb = "" Or ComboBoxLote_Reb = "" Then MsgBox "Selecciona los combos" ComboBoxCodigo_Reb.SetFocus Exit Sub End If ' For i = 0 To ListBox2.ListCount - 1 If ListBox2.List(i, 0) = ComboBoxCodigo_Reb And _ ListBox2.List(i, 1) = ComboBoxLote_Reb Then stockdisp = CDbl(ListBox2.List(i, 3)) If CDbl(TextBoxCantidad_Reb) > stockdisp Then MsgBox "La cantidad es mayor al disponible" TextBoxCantidad_Reb.SetFocus Exit Sub End If Exit For End If Next ' Set h = Sheets("Registros") Set r = h.Columns("A") Set b = r.Find(ComboBoxCodigo_Reb, lookat:=xlWhole) If Not b Is Nothing Then ncell = b.Address Do 'detalle If h.Cells(b.Row, "B") = ComboBoxLote_Reb Then Call ordenarstock(h.Cells(b.Row, "G"), b.Row) End If Set b = r.FindNext(b) Loop While Not b Is Nothing And b.Address <> ncell End If ' cant_rebajar = CDbl(TextBoxCantidad_Reb) For i = 1 To valores.Count wval = valores(i) wfil = filas(i) If wval > 0 Then If wval <= cant_rebajar Then h.Cells(wfil, "F") = h.Cells(wfil, "F") + wval h.Cells(wfil, "G") = h.Cells(wfil, "G") - wval cant_rebajar = cant_rebajar - wval Else h.Cells(wfil, "F") = h.Cells(wfil, "F") + cant_rebajar h.Cells(wfil, "G") = h.Cells(wfil, "G") - cant_rebajar cant_rebajar = 0 End If If cant_rebajar = 0 Then Exit For End If Next Set valores = Nothing Set filas = Nothing ComboBoxCodigo_Reb_Change TextBoxCantidad_Reb = "" MsgBox "Rebaja actualizada", vbInformation, "REBAJAS" End Sub
Lo que deseo es que si en el caso que haga un descuento mal hecho pueda volver atras con los valores de la ultima rebaja que se hizo!!
1 Respuesta
Respuesta de Dante Amor
2