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.

Pasar datos de una sola columna a varias filas

publicado

Buenas tardes, estoy intentando hacer un código para que cogiendo todos los datos de una columna, me los convierta en varias filas, es decir, en la columna tengo Nombre1, apellidos1, telefono1, Nombre2, apellidos2, telefono2, ... y quiero que cada registro me lo muestre en una fila:

 

Sub make_matrix()
    Dim Arr_1()
    Dim lnumRows As Long, lnumCols As Long
    Dim rngDestRange As Range, rngCellDest As Range
    Dim i As Long, j As Long, x As Long
    Dim lCounter As Long


    If Selection.Count < 4 Then
        MsgBox "Debe seleccionar un rango de por lo menos cuatro celdas", vbExclamation
        Exit Sub
    End If

    lnumRows = Application.InputBox("Cuantas filas en la matriz?", "Filas", , , , , , 2)
    lnumCols = Application.InputBox("Cuantas columnas en la matriz?", "Columnas", , , , , , 2)

    ReDim Arr_1(1 To lnumCols, 1 To lnumRows)

    Set rngCellDest = Application.InputBox("Posicion de la primera celda de la matriz", "Copiar matriz", , , , , , 8)
    Set rngDestRange = rngCellDest.Range(Cells(1, 1), Cells(lnumCols, lnumRows))

    lCounter = 0

    For j = 1 To lnumRows
        For i = 1 To lnumCols
            Arr_1(j, i) = Selection.Item(lCounter + 1)
            lCounter = lCounter + 1
        Next i
    Next j

    rngDestRange.Value = WorksheetFunction.Transpose(Arr_1)


End Sub

Featured Replies

publicado

Hola @djsilva2220, puedes subir el archivo con datos de ejemplo que ilustren como se tienen los datos en un inicio y como debiera ser el resultado final. Saludos!

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.