Saltar al contenido principal

¿Cómo crear nuevas hojas para cada fila en Excel?

Supongamos que tiene una tabla de puntajes con el nombre de todos los estudiantes en la columna A. Ahora desea crear nuevas hojas basadas en estos nombres en la columna A, y crear por hoja contiene los datos de un estudiante único. O simplemente cree una nueva hoja para cada fila de la tabla sin considerar los nombres en la columna A. En este video, obtendrá métodos para lograrlo.

Cree nuevas hojas para cada fila con código VBA
Cree nuevas hojas para cada fila con la utilidad Datos divididos de Kutools para Excel


Cree nuevas hojas para cada fila con código VBA

Con los siguientes códigos, puede crear una nueva hoja basada en valores de columna, o simplemente crear nuevas hojas para cada fila en Excel.

1. Prensa otro + F11 teclas simultáneamente para abrir el Microsoft Visual Basic para aplicaciones ventana.

2. En el Microsoft Visual Basic para aplicaciones ventana, haga clic recuadro > Módulo. Y luego pegue el siguiente código en el Módulo ventana.

Código de VBA: cree una nueva hoja para cada fila según la columna

Sub parse_data()
'Update by Extendoffice 2018/3/2
    Dim xRCount As Long
    Dim xSht As Worksheet
    Dim xNSht As Worksheet
    Dim I As Long
    Dim xTRrow As Integer
    Dim xCol As New Collection
    Dim xTitle As String
    Dim xSUpdate As Boolean
    Set xSht = ActiveSheet
    On Error Resume Next
    xRCount = xSht.Cells(xSht.Rows.Count, 1).End(xlUp).Row
    xTitle = "A1:C1"
    xTRrow = xSht.Range(xTitle).Cells(1).Row
    For I = 2 To xRCount
        Call xCol.Add(xSht.Cells(I, 1).Text, xSht.Cells(I, 1).Text)
    Next
    xSUpdate = Application.ScreenUpdating
    Application.ScreenUpdating = False
    For I = 1 To xCol.Count
        Call xSht.Range(xTitle).AutoFilter(1, CStr(xCol.Item(I)))
        Set xNSht = Nothing
        Set xNSht = Worksheets(CStr(xCol.Item(I)))
        If xNSht Is Nothing Then
            Set xNSht = Worksheets.Add(, Sheets(Sheets.Count))
            xNSht.Name = CStr(xCol.Item(I))
        Else
            xNSht.Move , Sheets(Sheets.Count)
        End If
        xSht.Range("A" & xTRrow & ":A" & xRCount).EntireRow.Copy xNSht.Range("A1")
        xNSht.Columns.AutoFit
    Next
    xSht.AutoFilterMode = False
    xSht.Activate
    Application.ScreenUpdating = xSUpdate
End Sub

Note: A1: C1 es el rango de títulos de su tabla. Puede cambiarlo según sus necesidades.

3. Prensa F5 clave para ejecutar el código, luego se crean nuevas hojas de trabajo después de todas las hojas de trabajo del libro de trabajo actual como se muestra a continuación:

Si desea crear directamente nuevas hojas para cada fila sin tener en cuenta el valor de la columna, puede utilizar el siguiente código.

Código de VBA: cree directamente una nueva hoja para cada fila

Sub RowToSheet()
	Dim xRow As Long
	Dim I As Long
	With ActiveSheet
		xRow = .Range("A" & Rows.Count).End(xlUp).Row
		For I = 1 To xRow
			Worksheets.Add(, Sheets(Sheets.Count)).Name = "Row " & I
			.Rows(I).Copy Sheets("Row " & I).Range("A1")
		Next I
	End With
End Sub

Después de ejecutar el código, cada fila de la hoja de trabajo activa se colocará en una nueva hoja de trabajo.

Note: La fila de encabezado también se colocará en una nueva hoja con este código VBA.


Cree nuevas hojas para cada fila con la utilidad Datos divididos de Kutools para Excel

En realidad, el método anterior es complicado y difícil de entender. En esta sección, te presentamos las Dividir datos utilidad de Kutools for Excel.

Antes de aplicar Kutools for Excel, Por favor descargarlo e instalarlo en primer lugar.

1. Seleccione la tabla que necesita usar para crear nuevas hojas y luego haga clic en Kutools Más> Escupir datos. Ver captura de pantalla:

2. En el Dividir datos en varias hojas de trabajo cuadro de diálogo, haga lo siguiente.

A. Para crear nuevas hojas basadas en el valor de la columna:

1). Por favor seleccione el Columna específica y especifique una columna en la que desee dividir los datos en la lista desplegable;
2). Si desea nombrar las hojas de trabajo con valores de columna, seleccione Valores de columna existentes Reglas la lista desplegable;
3). Haga clic en el OK botón. Ver captura de pantalla:

B. Para crear directamente nuevas hojas para cada fila:

1). Seleccione Filas fijas opción, ingrese el número 1 en la caja;
2). Seleccione Números de fila del desplegable Reglas la lista desplegable;
3). Haga clic en el OK botón. Ver captura de pantalla:

Se crea un nuevo libro con todas las hojas nuevas adentro. Vea las capturas de pantalla a continuación.

Crear nuevas hojas para cada fila según el valor de la columna:

Creando una nueva hoja para cada fila sin considerar el valor de la columna:

  Si desea tener una prueba gratuita (30 días) de esta utilidad, haga clic para descargarloy luego vaya a aplicar la operación según los pasos anteriores.

Cree nuevas hojas para cada fila con la utilidad Datos divididos de Kutools para Excel

Las mejores herramientas de productividad de oficina

🤖 Asistente de IA de Kutools: Revolucionar el análisis de datos basado en: Ejecución inteligente   |  Generar codigo  |  Crear fórmulas personalizadas  |  Analizar datos y generar gráficos  |  Invocar funciones de Kutools...
Características populares: Buscar, resaltar o identificar duplicados   |  Eliminar filas en blanco   |  Combine columnas o celdas sin perder datos   |   Ronda sin fórmula ...
Super búsqueda: Búsqueda virtual de criterios múltiples    Búsqueda V de valores múltiples  |   VLookup en varias hojas   |   Búsqueda difusa ....
Lista desplegable avanzada: Crear rápidamente una lista desplegable   |  Lista desplegable dependiente   |  Lista desplegable de selección múltiple ....
Administrador de columnas: Agregar un número específico de columnas  |  Mover columnas  |  Toggle Estado de visibilidad de columnas ocultas  |  Comparar rangos y columnas ...
Características destacadas: Enfoque de cuadrícula   |  Vista de diseño   |   Gran barra de fórmulas    Administrador de hojas y libros de trabajo   |  Biblioteca de Recursos (Texto automático)   |  Selector de fechas   |  Combinar hojas de trabajo   |  Cifrar/descifrar celdas    Enviar correos electrónicos por lista   |  Súper filtro   |   Filtro especial (filtro negrita/cursiva/tachado...) ...
Los 15 mejores conjuntos de herramientas12 Texto Herramientas (Añadir texto, Quitar caracteres, ...)   |   50+ Tabla Tipos (Diagrama de Gantt, ...)   |   40+ Práctico Fórmulas (Calcular la edad según el cumpleaños, ...)   |   19 Inserción Herramientas (Insertar código QR, Insertar imagen desde la ruta, ...)   |   12 Conversión Herramientas (Números a palabras, Conversión de Moneda, ...)   |   7 Fusionar y dividir Herramientas (Filas combinadas avanzadas, Células partidas, ...)   |   ... y más

Mejore sus habilidades de Excel con Kutools for Excel y experimente la eficiencia como nunca antes. Kutools for Excel ofrece más de 300 funciones avanzadas para aumentar la productividad y ahorrar tiempo.  Haga clic aquí para obtener la función que más necesita...

Descripción


Office Tab lleva la interfaz con pestañas a Office y hace que su trabajo sea mucho más fácil

  • Habilite la edición y lectura con pestañas en Word, Excel, PowerPoint, Publisher, Access, Visio y Project.
  • Abra y cree varios documentos en nuevas pestañas de la misma ventana, en lugar de en nuevas ventanas.
  • ¡Aumenta su productividad en un 50% y reduce cientos de clics del mouse todos los días!
Comments (33)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
HI, Thanks for this wonder-full code, Can we get dynamic sheet, means if i update data in respective sheet it will get updated in main sheet.
This comment was minimized by the moderator on the site
Hi vikas chandra,
I can't fix this problem. Sorry about that.
This comment was minimized by the moderator on the site
Hi, I have a problem about title, the title range of my table is A1:AI2, when I changed the code like that it doesn't work.

***Note: A1:C1 is the title range of your table. You can change it based on your needs.***
This comment was minimized by the moderator on the site
Hello, thanks so much for this. I'm looking to modify the macro such that it will create a sheet for each row of a column and within each sheet have a function (average) that I can populate data into and in turn have the outcome linked back into the original sheet. Is this possible? I can try to clarify further if this doesn't make sense or is ambiguous.
This comment was minimized by the moderator on the site
Hi, is there a code which would add only 1 new sheet each time the macro is run, eg 1st time the new sheet would be named on the contents of cell A1, 2nd time the macro was run the new sheet would be named on the contents of A2 etc. thanks in anticipation
This comment was minimized by the moderator on the site
Hello, used this code and worked, but If I want select the more then one rows in header, what will be change in the code ? I have multiple lines in the sheet which I want in every sheet.
This comment was minimized by the moderator on the site
Hello, did you figured out how?
This comment was minimized by the moderator on the site
Hello! I just used this code and it worked! In addition to creating a new sheet for each entry, I want to transpose it to columns and can't figure it out. So for the above example, the output for Nana would look like this - Name NanaScore 86No. 2
This comment was minimized by the moderator on the site
<p> Nana
86
2</p>
This comment was minimized by the moderator on the site
How to reference the use of the code above (credit) ? Is it possible to modify the code ?
This comment was minimized by the moderator on the site
Hi, this is an open communication platform. The code is allowed to reference and modify.
This comment was minimized by the moderator on the site
Nevermind it was hidden trailing spaces. I used the TRIM feature and cleaned it up. Having a row count (line count really so rows -1 prepended to the sheet would be amazing)
This comment was minimized by the moderator on the site
Please can i get help on how to automatically name the sheets using a particular column. This is for the row to sheet VBA. See below

Sub RowToSheet()

Dim xRow As Long

Dim I As Long

With ActiveSheet

xRow = .Range("A" & Rows.Count).End(xlUp).Row

For I = 1 To xRow

Worksheets.Add(, Sheets(Sheets.Count)).Name = "Row " & I

.Rows(I).Copy Sheets("Row " & I).Range("A1")

Next I

End With

End Sub
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations