Como mosstrar datos de forma vertical de un formulario en una baase de excel

Hola Dante Amor nuevamente solicitando tu ayuda con base a la ayuda anterior es requiero lo mismo pero con una pequeña modificación

Reuiero que en la captura los datos que se guarden en la hoja apaarezcan así

Para que tenga mejor visibilidad la infprmacion ya que de esa forma genero un reporte cumplimiento

1 respuesta

Respuesta
1

Te anexo el código actualizado

Private Sub Cmd_Guardar_Click()
'
    'VALIDACIONES
    existe = False
    For Each ctx In Controls
        If TypeOf ctx Is MSForms.ComboBox Or _
           TypeOf ctx Is MSForms.TextBox Or _
           TypeOf ctx Is MSForms.CheckBox Then
            ctx.BackColor = &H80000005
        End If
    Next
    'Controles de combo
        cmbs = Array(Cmbx_Operador, Mot_1, Mot_2)
        For i = LBound(cmbs) To UBound(cmbs)
            If cmbs(i).Value = "" Or cmbs(i).ListIndex = -1 Then
                existe = True
                cmbs(i).BackColor = RGB(255, 0, 0)
            End If
        Next
    'Controles de texto
        txts = Array(sap, Plza, sucursal, Camioneta, fecha, _
                    Sku1, descripcion_uno, Sku2, descripcion_dos, _
                    Sku3, descripcion_tres, Sku4, descripcion_cuatro, _
                    promo1, descripcion_cinco, promo2, descripcion_seis, _
                    comentarios)
        For i = LBound(txts) To UBound(txts)
            If txts(i).Value = "" Then
                existe = True
                txts(i).BackColor = RGB(255, 0, 0)
            End If
        Next
    'Controles de checkbox
        If uno_si.Value = False And uno_no.Value = False Then
            uno_si.BackColor = RGB(255, 0, 0)
            existe = True
        End If
        If dos_si.Value = False And dos_no.Value = False Then
            dos_si.BackColor = RGB(255, 0, 0)
            existe = True
        End If
    'Controles de número
        nums = Array(empaque, Cant_1, Cant_2, Cant_3, Cant_4, Cant_5, Cant_6)
        For i = LBound(nums) To UBound(nums)
            If nums(i).Value = "" Or Not IsNumeric(nums(i).Value) Then
                existe = True
                nums(i).BackColor = RGB(255, 0, 0)
            End If
        Next
    '
    If existe Then
        MsgBox "Existen errores en la captura. Revisar"
        Exit Sub
    End If
    '
    'Si ya no existen errores, entonces se guarda la información en la hoja
    Sheets("ENC").Select
    u = Range("A" & Rows.Count).End(xlUp).Row + 1
    For i = 0 To 5
        Cells(u + i, 1) = sap.Text
        Cells(u + i, 2) = Plza.Text
        Cells(u + i, 3) = sucursal.Text
        Cells(u + i, 4) = Cmbx_Operador.Text
        Cells(u + i, 5) = Camioneta.Text
        Cells(u + i, 6) = fecha.Text
        Cells(u + i, 7) = empaque.Text
        '
        Cells(u + i, 11) = comentarios.Value
        Cells(u + i, 12) = IIf(uno_si, "Si", "No")
        Cells(u + i, 13) = Mot_1.Value
        Cells(u + i, 14) = IIf(dos_si, "Si", "No")
        Cells(u + i, 15) = Mot_2.Value
    Next
    '
    Cells(u, 8) = Sku1.Value
    Cells(u, 9) = descripcion_uno.Value
    Cells(u, 10) = Cant_1.Value
    Cells(u + 1, 8) = Sku2.Value
    Cells(u + 1, 9) = descripcion_dos.Value
    Cells(u + 1, 10) = Cant_2.Value
    Cells(u + 2, 8) = Sku3.Value
    Cells(u + 2, 9) = descripcion_tres.Value
    Cells(u + 2, 10) = Cant_3.Value
    Cells(u + 3, 8) = Sku4.Value
    Cells(u + 3, 9) = descripcion_cuatro.Value
    Cells(u + 3, 10) = Cant_4.Value
    Cells(u + 4, 8) = promo1.Value
    Cells(u + 4, 9) = descripcion_cinco.Value
    Cells(u + 4, 10) = Cant_5.Value
    Cells(u + 5, 8) = promo2.Value
    Cells(u + 5, 9) = descripcion_seis.Value
    Cells(u + 5, 10) = Cant_6.Value
    '
    usuario = Application.UserName
    Mensaje = usuario & " " & "¿Desea continuar capturando ?" & " " & Now 'Define el mensaje
    Estilo = vbYesNo + vbCritical + vbDefaultButton2 ' Define los botones  que se mostrarán
    Titulo = "Base Captura ALEN" 'Define el titulo que se mostrará en la ventana
    Ayuda = "DEMO.HLP" ' Define el archivo de ayuda
    Ctxt = 1000 'Define el tema 'El texto 'Muestra el mensaje
    If MsgBox(Mensaje, Estilo, Titulo, Ayuda, Ctxt) = vbNo Then Unload Me
    '
    For Each ctx In Controls
        If TypeOf ctx Is MSForms.ComboBox Or _
           TypeOf ctx Is MSForms.TextBox Then
                ctx.Value = ""
        End If
        If TypeOf ctx Is MSForms.CheckBox Then
            ctx.Value = False
        End If
    Next
    fecha.SetFocus
End Sub

sal u dos

Gracias Dante

Agregue esto

Cells(u + i, 8) = total.Text
Cells(u + i, 8) = Sku1.Text
Cells(u + i, 8) = Sku2.Text
Cells(u + i, 8) = Sku3.Text
Cells(u + i, 8) = Sku4.Text
Cells(u + i, 8) = promo1.Text
Cells(u + i, 8) = promo2.Text
'
Cells(u + i, 9) = descripcion_uno.Text
Cells(u + i, 9) = descripcion_dos.Text
Cells(u + i, 9) = descripcion_tres.Text
Cells(u + i, 9) = descripcion_cuatro.Text
Cells(u + i, 9) = descripcion_cinco.Text
Cells(u + i, 9) = descripcion_seis.Text

Para la captura de los skus con su descripción pero el primero los primeros 2 skus no los guarda

Antes de agregar cosas a la macro prueba lo que te envié.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas