Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

problemas con la opcion guardar

publicado

Buenas noches compañeros macrolovers. tengo un archivo que tiene dos userform, el primero guarda datos a una base de datos y el otro  userform es para guardar mas datos en el transcurso de los dias.  EL PROBLEMA ES QUE TENGO 4 FILAS DE INFORMACIÓN Y AL QUERER MODIFICAR UNA FILA PARA AGREGAR NUEVOS DATOS, ESTA ME LA DUPLICA LOS DATOS . VEASE QUE LA INFORMACIÓN DE LA GUIA 2020 YA NO ESTA Y ESTÁ DOS VECES LA GUIA NUMERO 9000000.     POR FAVOR necesito ayuda con esto que me está rompiendo la cabeza Mil gracias de antemano

image.thumb.png.da2a87753215755edf05599c22d5fa49.png

image.thumb.png.5d40ebf80fd80caae1c57b5e40bc9b93.png

archivo.xlsm

Featured Replies

publicado

Código BT_BUSCAR

Private Sub BT_BUSCAR_Click()

    If Me.Textbuscar = "" Then
        MsgBox "Coloque el valor a buscar"
    End If
    With ListBox1
        ultimaFila = Sheets("Base de datos").Cells(Rows.Count, "A").End(xlUp).Row
        Y = 0
        
       .RowSource = ""
        For Filas = 3 To ultimaFila
            descripcion = Sheets("Base de datos").Cells(Filas, 2).Value
            If UCase(descripcion) Like "*" & UCase(Me.Textbuscar) & "*" Then
                .AddItem
                .List(Y, 0) = Sheets("Base de datos").Cells(Filas, 1).Value
                .List(Y, 1) = Sheets("Base de datos").Cells(Filas, 2).Value
                .List(Y, 2) = Sheets("Base de datos").Cells(Filas, 3).Value
                .List(Y, 3) = Sheets("Base de datos").Cells(Filas, 4).Value
                .List(Y, 4) = Sheets("Base de datos").Cells(Filas, 5).Value
                .List(Y, 5) = Sheets("Base de datos").Cells(Filas, 6).Value
                .List(Y, 6) = Sheets("Base de datos").Cells(Filas, 7).Value
                .List(Y, 7) = Sheets("Base de datos").Cells(Filas, 8).Value
                Y = Y + 1
            End If
        Next
    End With
End Sub

 

publicado

Código BT_EDITAR

Private Sub BT_EDITAR_Click()
    With ListBox1
        If .ListIndex = -1 Then
            MsgBox "Por favor seleccione un dato"
        Else
            For X = 0 To .ListCount - 1
                If .Selected(X) = True Then
                    fecha = .List(.ListIndex, 0)
                    guia = .List(.ListIndex, 1)
                    orden_trabajo = .List(.ListIndex, 2)
                    cliente = .List(.ListIndex, 3)
                    descripcion = .List(.ListIndex, 4)
                    recurso = .List(.ListIndex, 5)
                    peso = .List(.ListIndex, 6)
                    peso_montacarga = .List(.ListIndex, 7)
                    hora_entrada = Format(.List(.ListIndex, 8), "hh:mm")
                    hora_salida = Format(.List(.ListIndex, 9), "hh:mm")
                    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                    On Error Resume Next
                    tiempo_total = Format(.List(.ListIndex, 10), "hh:mm")
                    precio = .List(.ListIndex, 11)
                    Me.Textfecha = fecha
                    Me.Textguia = guia
                    Me.Textordendetrabajo = orden_trabajo
                    Me.Textcliente = cliente
                    Me.Textdescripcion = descripcion
                    Me.Textrecurso = recurso
                    Me.Textpeso = peso
                    Me.Textpesomontacarga = peso_montacarga
                    'Dim hora_entrada As String
                    'hora_entrada = "hh:mm" ' Puedes ajustar este formato según tus necesidades
                    ' Utiliza Format con las variables
                    Me.Textentrada = hora_entrada
                    Me.Textsalida = hora_salida
                    Me.Texttiempo = tiempo_total
                    Me.Textprecio = precio
                    Exit For
                End If
            Next X
        UserForm2.Height = 411
        End If
    End With
End Sub

 

publicado

Código BT_GUARDAR

Private Sub BT_GUARDAR_Click()

    Dim FILA As Object
    UserForm2.Height = 217.5
    Dim X As Long
    With Sheets("Base de datos")
        For X = 0 To Me.ListBox1.ListCount - 1
            If ListBox1.Selected(X) = True Then
                ValorBuscado = ListBox1.List(X, 1)
                Set linea = .Range("B:B").Find(ValorBuscado, Lookat:=xlWhole)
                Exit For
            End If
        Next X
        .Range("B" & linea.Row).Value = Me.Textguia.Value
        .Range("C" & linea.Row).Value = Me.Textordendetrabajo.Value
        .Range("D" & linea.Row).Value = Me.Textcliente.Value
        .Range("E" & linea.Row).Value = Me.Textdescripcion.Value
        .Range("F" & linea.Row).Value = Me.Textrecurso.Value
        .Range("G" & linea.Row).Value = Me.Textpeso.Value
        .Range("H" & linea.Row).Value = Me.Textpesomontacarga.Value
        .Range("I" & linea.Row).Value = Me.Textentrada.Value
        .Range("J" & linea.Row).Value = Me.Textsalida.Value
        .Range("K" & linea.Row).Value = Me.Texttiempo.Value
        .Range("L" & linea.Row).Value = Me.Textprecio.Value
    End With

End Sub

 

publicado

Modificaciones  realizadas respetando siempre al máximo tu código original

publicado
  • Autor

Muchas gracias Crack de Crack @JSDJSD miles de gracia, agradecido contigo, Ojala seas eterno amigo ❤️

Archivado

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.