+ Reply to Thread
Results 1 to 5 of 5

Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

  1. #1
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

    Hey

    I am not sure if this is possible, but I was hoping someone could help me out.

    I need to split a large amount of data into individual spreadsheets, which contain 500 rows per spreadsheet.

    I have a spreadsheet which has data from cells A1:V89720.

    A1:V1 is the header of each data field.

    The header needs to be on all the individual spreadsheets.

    They would just be saved to a desktop file called product split.

    The name of each spreadsheet can just be a numerical count, for example, the first spreadsheet 1, the second 2, etc.

    This should create 180 spreadsheets.

    Is what I'm looking for possible, or will I have to manually create each sheet?

    Thanks for taking the time to review this; it's much appreciated.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

    Don't do that.

    Just apply filters and view the information that you want to by filtering your data.

    If you want to only view 500 rows at a time, insert a new column - say, column W - headed 'Split' and fill the first 499 rows with the number 1. Then in cell W501, enter this formula

    =W2 + 1

    Then copy that down to match your data. Then just filter based on a number in column W
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

    I apologise for not being clear in my initial request. I have a sheet with approximately 100,000 cells that I need to split into separate workbooks, each containing 500 cells.

    This is because our system only allows uploads of 500 cells at a time.

    I was hoping for some code that would divide the 100,000 cells in one workbook into 200 distinct workbooks. Then I can upload them directly to the system.

    Thank you,

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,946

    Re: Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

    With the large sheet as the active sheet: I've assumed that the headers are in row 1 and need to be in every file.

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 01-29-2024 at 02:55 PM.

  5. #5
    Registered User
    Join Date
    08-10-2017
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    44

    Re: Splitting Excel Spreadsheet into Multiple 500 cell spreadsheets

    try this one.

    Sub SplitWithHeader()
    Dim WorkRng As Range
    Dim xRow As Range
    Dim SplitRow As Integer
    Dim xWs As Worksheet
    Dim i As Integer, j As Integer, k As Integer

    On Error Resume Next
    ExcelTitleId = "Split Row Numt"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", ExcelTitleId, WorkRng.Address, Type:=8)
    SplitRow = Application.InputBox("Split Row Num", ExcelTitleId, 4, Type:=1)
    Set xWs = WorkRng.Parent

    Application.ScreenUpdating = False

    ' Get header row from the source sheet
    Dim HeaderRow As Range
    Set HeaderRow = WorkRng.Rows(1)

    For i = 1 To WorkRng.Rows.Count Step SplitRow
    ' Determine the number of rows to copy
    Dim numRows As Integer
    numRows = SplitRow
    If i + numRows - 1 > WorkRng.Rows.Count Then
    numRows = WorkRng.Rows.Count - i + 1
    End If

    ' Determine if the sheet being created is the first sheet or not
    Dim isFirstSheet As Boolean
    isFirstSheet = (i = 1)

    ' Create new sheet
    Dim newSheet As Worksheet
    Set newSheet = ThisWorkbook.Worksheets.Add(After:=xWs)

    ' Copy header row if not the first sheet
    If Not isFirstSheet Then
    HeaderRow.Copy
    newSheet.Range("A1").PasteSpecial xlPasteAll
    End If

    ' Copy rows to new sheet
    WorkRng.Rows(i).Resize(numRows).Copy newSheet.Range("A" & IIf(isFirstSheet, 1, 2))
    Next i

    Application.CutCopyMode = False
    Application.ScreenUpdating = True

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 08-17-2015, 03:39 AM
  2. Replies: 0
    Last Post: 03-18-2015, 05:50 AM
  3. Splitting a report into multiple new spreadsheets
    By beaker100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2013, 08:53 AM
  4. Replies: 1
    Last Post: 08-15-2012, 08:41 PM
  5. Splitting Excel worksheet into spreadsheets
    By undergraduate in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-11-2011, 02:36 AM
  6. Add multiple spreadsheets to single spreadsheet
    By tmotommyo in forum Excel General
    Replies: 5
    Last Post: 02-06-2008, 11:35 PM
  7. Combining multiple spreadsheets to one spreadsheet
    By smorton in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 02-10-2005, 02:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1