Saltar al contenido

problemas al guardar


Celest3

Recommended Posts

publicado

hola a todos, hoy quisiera su ayuda con este problema que se me presentado, cuando crei que todo estaba terminado.

les explico, en el archivo adjunto es una pequeña aplicacion para registar reparaciones de maquinaria y la vez casa reportes de entre un rango de fechas o por maquina.

Problema 1:

- en el frm orden, al guardar (hoja historico) todo bien alparecer pues si entro a la hoja historico me voy con la sorpresa que algunos registro los a gudardo sobre un registro existente porque ni idea por eso pido su ayuda (ver en la hoja historico filas 227, 273,767 y 841 como ejemplo del problema)

problema 2:

- en el frm_reporte, la idea es que se escoge un codigo y despues seleccionar que tipo de mantenimiento deseo buscar que son "reparacion, mantenimiento o todas" pero solo me funciona todas.

Problema 3:

- pues no es un problema, mas quisiera agregar el tiempo que la maquina esta en el taller por ejemplo si ingreso 9am y se fue a las 11:15am al final de la orden debe decir tiempo en reparacion/mantenimieto: 2h15m y si esta ideas igual.

porque el egistro se inicia ni bien ingresa al taller en el frm orden veran que al final hay un check pues ese es el que da la fecha de salida y me gustaria que en tiempo tambien.

porque aveces me piden que les diga cuando tiempo a estado tal maquina en el taller, y yo ni que responderle solo me queda calcular al ojo.

bueno espero que se me entienda y me puedan dar una mano y sobre los datos no hay problema solo son datos de reparaciones y creo que a la vez le puede servir a otros usuarios.

http://dl.dropbox.com/u/108311084/Akelos.rar

se me olvida la clave de la hoja histórico es 10

Saludos

Celest3

publicado

Hola revisando este rpoycto me he dado con la sorpresa que el codigo para editar/modificar no funciona y me acuerdo quecundo empeze este proyecto si funcionaba. me puede ayudar diciendo donde esta mal el codigo y si tienes otra opcion sera bien aceptada.

este codigo es darle guadar:


Private Sub CmdGuardar_Click()ApplicationScreenUpdating = False
Sheets("historico").Unprotect "10"
Dim SFecha As Date
Rem Primero copia este codigo al comienzo del boton guardar
Rem Textbox que solo permite formato de Fecha
On Error Resume Next
If SFecha = CDate(Format(DTPicker2.Value, "dd/mm/yyyy")) Then
MsgBox "Edite Formato de Fecha dd/mm/aaaa", vbExclamation, "Excel Servicios"
Exit Sub
End If


If DTPicker2.Value = DTPicker1.Value Or DTPicker2.Value > DTPicker1.Value Then
Dim a
'
a = TextBox1.Value


If TextBox1 <> Empty Then
If Application.WorksheetFunction.CountIf(Range("A:A"), TextBox1) Then

If MsgBox("Guardar cambios realizados?", vbYesNo + vbQuestion, "INFORMACION") = vbNo Then Exit Sub
Columns("A:A").Select

Cells.Find(what:=TextBox1, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False).Activate

almacenar

MsgBox "El registro se ha modificado modificar", vbInformation, "MENSAJE"

If MsgBox("Desea imprimir?", vbYesNo + vbQuestion, "PREGUNTA") = vbYes Then
imprimir
End If

Exit Sub
End If
End If


Application.ScreenUpdating = False
Sheets("historico").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Cells.Find(what:=a, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

almacenar

If MsgBox("Desea imprimir?", vbYesNo + vbQuestion, "PREGUNTA") = vbYes Then
imprimir
End If


TextBox1.Enabled = True
Frame3.Enabled = False
Frame4.Enabled = False
txtRecepcion.Enabled = False
txtprocedi.Enabled = False
txtobservaciones.Enabled = False
DTPicker2.Enabled = False
DTPicker1.Enabled = False
Cbrealizado.Enabled = False
cmdguardar.Enabled = False
Cmdeditar.Enabled = True
txtcodigo.Enabled = False
TextBox1.SetFocus
Exit Sub
Else
MsgBox "La fecha Ingresada no es correcta", vbExclamation, "Excel Servicios"
End If
Application.ScreenUpdating = True
'GUARDA EL LIBRO AUTOMATICAMENTE
ThisWorkbook.Save
Sheets("historico").Protect "10"
Sheets("AKELOS2.6.1").Select
End Sub
[/code]

Este codigo es el procedimiento almacenar


Function almacenar()

If opCorrectivo.Value = True Then
' ActiveCell = txtconta.Value
'activeCell.Offset(0, 1) = txtconta.Value
ActiveCell.Offset(0, 1) = CDate(DTPicker1.Value)
ActiveCell.Offset(0, 2) = txtcodigo.Text
ActiveCell.Offset(0, 3) = txtdescripcion.Value
ActiveCell.Offset(0, 4) = txtoperador.Value
ActiveCell.Offset(0, 5) = cbsector.Text
ActiveCell.Offset(0, 6) = txtjefe.Value
If opCorrectivo.Value = True Then
ActiveCell.Offset(0, 7) = opCorrectivo.Caption
End If
If opCorrectivo.Value = True Then
ActiveCell.Offset(0, 7) = OpPreventivo.Caption
End If
ActiveCell.Offset(0, 8) = txtRecepcion.Value
ActiveCell.Offset(0, 9) = Cbproced.Value
ActiveCell.Offset(0, 10) = txtprocedi.Value
ActiveCell.Offset(0, 11) = txtobservaciones.Value
ActiveCell.Offset(0, 12) = CDate(DTPicker2.Value)
ActiveCell.Offset(0, 13) = Cbrealizado.Value
ActiveCell.Offset(0, 14) = Val(txthoro.Text)
End If


End Function
[/CODE]

por favor su apoyo con este problema, el frm_consulta, esta el link de descarga en el 1er post.

gracias

Saludos,

Celest3

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

  • 109 ¿Te parecen útiles los tips de las funciones? (ver tema completo)

    1. 1. ¿Te parecen útiles los tips de las funciones?


      • No
      • Ni me he fijado en ellos

  • Ayúdanos a mejorar la comunidad

    • Donaciones recibidas este mes: 0.00 EUR
      Objetivo: 130.00 EUR
  • Archivos

  • Estadísticas de descargas

    • Archivos
      188
    • Comentarios
      98
    • Revisiones
      29

    Más información sobre "Cambios en el Control Horario"
    Última descarga
    Por pegones1

    4    1

  • Crear macros Excel

  • Mensajes

    • Hola, veo que tienes 365, así que esta forma funcionará   Almacen.xlsx
    • Buenos días  @LeandroA espero estes bien Tengo un caso idéntico al planteado en la siguiente pregunta: Sin embargo, a diferencia de quien planteo originalmente la pregunta al correr el código no obtengo ningún resultado podrían ayudarme a resolver este inconveniente y que al hacer click en el Botón Guardar (CommandButton3) del Formulario RCS (frmrcs) el archivo pdf quede configurado con orientación vertical, márgenes superior, inferior, derecho e izquierdo = 1 y en página tamaño carta. Si acaso influye uso Microsoft Excel LTSC MSO (versión 2209 Compilación16.0.1.15629.20200) de 64 bits Mucho le sabre agradecer la ayuda que me pueda dar  RCS PRUEBA - copia.xlsm
    • @JSDJSDCon gusto mi estimado Para la opción 1: Sub Surtirhastadondealcanse() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets(1) Dim filaInicio As Integer: filaInicio = 4 Dim filaFin As Integer: filaFin = 7 Dim colInventario As Integer: colInventario = 2 Dim colSolicitudesInicio As Integer: colSolicitudesInicio = 4 ' Columna C Dim colResultadoInicio As Integer: colResultadoInicio = 9 ' Columna I Dim colTotalSurtido As Integer: colTotalSurtido = 12 ' Columna L Dim colFinalInventario As Integer: colFinalInventario = 13 ' Columna M Dim numClientes As Integer: numClientes = 3 Dim fila As Integer, i As Integer For fila = filaInicio To filaFin Dim inventario As Double inventario = Val(ws.Cells(fila, colInventario).Value) Dim solicitudes(1 To 3) As Double Dim surtido(1 To 3) As Variant Dim totalSurtido As Double: totalSurtido = 0 ' Leer solicitudes For i = 1 To numClientes If IsNumeric(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Then solicitudes(i) = CDbl(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Else solicitudes(i) = 0 End If surtido(i) = "POR FALTA STOCK" Next i ' Surtir de acuerdo al inventario disponible For i = 1 To numClientes If solicitudes(i) > 0 Then If inventario >= solicitudes(i) Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) ElseIf inventario > 0 Then surtido(i) = inventario totalSurtido = totalSurtido + inventario inventario = 0 Else surtido(i) = "POR FALTA STOCK" End If End If Next i ' Escribir resultados en las columnas correspondientes para cada cliente For i = 1 To numClientes With ws.Cells(fila, colResultadoInicio + i - 1) If surtido(i) = "POR FALTA STOCK" Then .Value = surtido(i) .Font.Color = vbRed Else .Value = surtido(i) .Font.Color = vbBlack End If End With Next i ' Escribir total surtido y existencia final ws.Cells(fila, colTotalSurtido).Value = totalSurtido ws.Cells(fila, colFinalInventario).Value = inventario Next fila MsgBox "Resultado surtido cargado con éxito...", vbInformation End Sub Para la opción 2:   Sub surtirenpartesiguales() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets(1) Dim filaInicio As Integer: filaInicio = 13 Dim filaFin As Integer: filaFin = 16 Dim colInventario As Integer: colInventario = 2 Dim colSolicitudesInicio As Integer: colSolicitudesInicio = 4 ' Columna C Dim colResultadoInicio As Integer: colResultadoInicio = 9 ' Columna I Dim colTotalSurtido As Integer: colTotalSurtido = 12 ' Columna L Dim colFinalInventario As Integer: colFinalInventario = 13 ' Columna M Dim numClientes As Integer: numClientes = 3 Dim fila As Integer, i As Integer For fila = filaInicio To filaFin Dim inventario As Double inventario = Val(ws.Cells(fila, colInventario).Value) Dim solicitudes(1 To 3) As Double Dim surtido(1 To 3) As Variant Dim totalSurtido As Double: totalSurtido = 0 Dim totalPedido As Double: totalPedido = 0 ' Leer solicitudes For i = 1 To numClientes If IsNumeric(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) Then solicitudes(i) = CDbl(ws.Cells(fila, colSolicitudesInicio + i - 1).Value) totalPedido = totalPedido + solicitudes(i) Else solicitudes(i) = 0 End If surtido(i) = 0 Next i ' Si hay suficiente inventario, surtir lo que el cliente pide If inventario >= totalPedido Then For i = 1 To numClientes If solicitudes(i) > 0 And inventario >= solicitudes(i) Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) End If Next i Else ' Reparto base igualitario Dim baseSurtido As Long baseSurtido = Int(inventario / numClientes) For i = 1 To numClientes If solicitudes(i) > 0 Then If solicitudes(i) <= baseSurtido Then surtido(i) = solicitudes(i) inventario = inventario - solicitudes(i) totalSurtido = totalSurtido + solicitudes(i) Else surtido(i) = baseSurtido inventario = inventario - baseSurtido totalSurtido = totalSurtido + baseSurtido End If End If Next i ' Repartir sobrante restante uno por uno, respetando lo pedido Do While inventario > 0 For i = 1 To numClientes If surtido(i) < solicitudes(i) Then surtido(i) = surtido(i) + 1 totalSurtido = totalSurtido + 1 inventario = inventario - 1 If inventario = 0 Then Exit For End If Next i Loop End If ' Escribir resultados en las columnas correspondientes para cada cliente For i = 1 To numClientes With ws.Cells(fila, colResultadoInicio + i - 1) If surtido(i) = 0 Then .Value = "POR FALTA STOCK" .Font.Color = vbRed Else .Value = surtido(i) .Font.Color = vbBlack End If End With Next i ' Escribir total surtido y existencia final ws.Cells(fila, colTotalSurtido).Value = totalSurtido ws.Cells(fila, colFinalInventario).Value = inventario Next fila MsgBox "Resultado surtido cargado con éxito...", vbInformation End Sub Saludos, Diego
    • Buenos dias.  Estoy trabajando en una hoja para poder llevar un control de un pequeño almacén.  Tengo un pedido con varias líneas y "lotes" y necesito sacar las ubicaciones que coincidan con la referencia y lote que pone en el pedido. El problema viene cuando tengo la misma referencia y mismo lote en ubicaciones diferentes y necesito sacar la información en columnas diferentes. No se si  me he explicado bien, pero creo que con el ejemplo adjunto se entiende mejor. Agradecería mucho si me pudieran ayudar  Libro1.xlsx
    • Exelente solución mil gracias 
  • Visualizado recientemente

    • No hay usuarios registrado para ver esta página.
×
×
  • Crear nuevo...

Información importante

Echa un vistazo a nuestra política de cookies para ayudarte a tener una mejor experiencia de navegación. Puedes ajustar aquí la configuración. Pulsa el botón Aceptar, si estás de acuerdo.