Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to split data into multiple worksheets by rows count in Excel?

For example, I have a range of data list, now I want to split it into multiple worksheets by rows count, in this example, I will split it by every 5 rows (see following screenshots). Are there any ways to help us solve this problem quickly? Here I will introduce two tricks for you to get it done easily.


doc-split-data-by-rows1


-2



doc-split-data-by-rows2
doc-split-data-by-rows3
doc-split-data-by-rows4
doc-split-data-by-rows5

Split data into multiple worksheets by rows count with VBA code

Split data into multiple worksheets by rows count with Kutools for Excel

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words...
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum...
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns...
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Create Mailing List and Send Emails by Cell's Value...
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

arrow blue right bubble Split data into multiple worksheets by rows count with VBA code


The following VBA code can help you split the rows into multiple worksheets by rows count, do as follows:

1. Hold down the ALT + F11 key to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA: Split data into sheets by rows count in Excel.

Sub SplitData()
'Updateby20140617
Dim WorkRng As Range
Dim xRow As Range
Dim SplitRow As Integer
Dim xWs As Worksheet
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
SplitRow = Application.InputBox("Split Row Num", xTitleId, 5, Type:=1)
Set xWs = WorkRng.Parent
Set xRow = WorkRng.Rows(1)
Application.ScreenUpdating = False
For i = 1 To WorkRng.Rows.Count Step SplitRow
    resizeCount = SplitRow
    If (WorkRng.Rows.Count - xRow.Row + 1) < SplitRow Then resizeCount = WorkRng.Rows.Count - xRow.Row + 1
    xRow.Resize(resizeCount).Copy
    Application.Worksheets.Add after:=Application.Worksheets(Application.Worksheets.Count)
    Application.ActiveSheet.Range("A1").PasteSpecial
    Set xRow = xRow.Offset(SplitRow)
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

3. Then press F5 key to run the code, and a dialog pops out for selecting a range to split, and then click OK, and another dialog for you to specify the rows count. See screenshot:

4. Click OK, and the range are split into multiple sheets by the rows count.

Note: The split worksheets are placed at the back of the master worksheet.


arrow blue right bubble Split data into multiple worksheets by rows count with Kutools for Excel

The above code can only split the data by the specified rows count, and it will not add the title for each worksheet data if your data has the title.

But with Kutools for Excel’s Split Data, you not only can insert the headers for each worksheet data, but also can specify the new split worksheet names.

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 30 days. Get it Now

If you have installed Kutools for Excel, please do as follows:

1. Select the range of data that you want to split.

2. Click Enterprise > Worksheet Tools > Split Data (or Enterprise > Split Data ), see screenshot:

doc-split-data-by-rows6

3. In the Split Data into Multiple Worksheets dialog box:

  • Select Fixed rows from Split based on option, and enter the number of rows count that you want to split for each worksheets. (If your data has headers and you want to insert them into each new split worksheet, please check My data has headers option.)
  • Then you can specify the split worksheet names, under the New worksheets name section, select the worksheet names rules from the Rules drop down list, you can add the Prefix or Suffix for the sheet names as well. See screenshot:

doc-split-data-by-rows7

4. After specify the settings, then click OK, and the selected data has been split into multiple worksheets of a new workbook by every 5 rows. And the headers are inserted for each new worksheet. See screenshot:

doc-split-data-by-rows8

Click to know more about this Split Data feature.

Related article:

How to split data into multiple worksheets based on column in Excel?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    eve · 2 months ago
    Minmatar detected :O
  • To post as a guest, your comment is unpublished.
    ali · 5 months ago
    thank you. saved a lot of my time.
  • To post as a guest, your comment is unpublished.
    DragonKing · 5 months ago
    Years later, and this still holds up excellently. Thanks!
  • To post as a guest, your comment is unpublished.
    Max · 1 years ago
    Omg thank you so very much dude!
  • To post as a guest, your comment is unpublished.
    prasanna · 1 years ago
    Hi Thanks for this great code, but the concern is, here we can only split fixed number of rows, can you help me with split is based on some name or code, because i have different set of rows for each worksheet.
  • To post as a guest, your comment is unpublished.
    aparna · 2 years ago
    hi this works great but want the output as string how can i modify the code or i can say example : 'output',
  • To post as a guest, your comment is unpublished.
    Ralph · 2 years ago
    Thanks a lot for the fantastic VBA-Script. But how to modify it to keep the header row on every split?
  • To post as a guest, your comment is unpublished.
    Ralph · 2 years ago
    Thanks, for this fantastic VBA-Script. But how to configure it to repeat the header row on every split?
  • To post as a guest, your comment is unpublished.
    Gunesh Chandran · 2 years ago
    Thanks a lot for this tutorial. It is working fine.
  • To post as a guest, your comment is unpublished.
    Adam Dicker · 3 years ago
    Is there a way to split and then exp[ort to multiple HTML files?
  • To post as a guest, your comment is unpublished.
    Amy Takers · 3 years ago
    We can increase rankings of your website in all major search engines at a very affordable price. Email us back to get a full proposal.
  • To post as a guest, your comment is unpublished.
    MattG · 3 years ago
    I've searched endlessly for this. Thank you so much for this tutorial!!!!
  • To post as a guest, your comment is unpublished.
    John Boyd · 4 years ago
    Works great coupled with this one as necessary: http://www.extendoffice.com/documents/excel/628-excel-split-workbook.html
  • To post as a guest, your comment is unpublished.
    Teri · 4 years ago
    It works with one row of column headers. I use multiple rows that include averages and totals. Plus, I have a distribution chart at the bottom. How can I keep these intact? Currently this info is not transferring over to the new worksheets it creates.
  • To post as a guest, your comment is unpublished.
    Teri · 4 years ago
    I have multiple rows of column headers containing averages and totals at the top of each sheet. I have a distribution chart at the bottom. This needs to be kept on each new sheet split out. How do I make this happen with the tool?
  • To post as a guest, your comment is unpublished.
    joms · 5 years ago
    hello,

    its not working for me. my data is coming from a pivot table and it has header. this vba can export some data but not all... pls assist
  • To post as a guest, your comment is unpublished.
    Lijesh · 5 years ago
    Great . It is awesome ...

    Thanks