• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Break excel data into multiple files

jaiveer

New Member
Hi,

I would like know if it is possible to break excel data into multiple files.

I need to upload inventory levels to our server however it can only handle 3000 rows at a time, so i need to split the files up (in files of 3000 rows)

Is there a code for this? Please see file attached.

My excel skills aren't that great so if you could please outline the steps at a 'noob level'.
 

Attachments

This might help...

Code:
Sub split()
Dim lrow As Long, i As Long, wb As Workbook, ws As Worksheet
Application.ScreenUpdating = False
lrow = Range("A" & Rows.Count).End(xlUp).Row
Set ws = Sheets("stock")
For i = 1 To lrow Step 3000
 Set wb = Workbooks.Add(xlWBATWorksheet)
    With wb
        ws.Range(ws.Cells(i + 1, 1), ws.Cells(i + 3000, 2)).Copy
            .Sheets.Add().Name = ws.Name
                .Sheets(ws.Name).Paste
            Cells.EntireColumn.AutoFit
        .SaveAs Filename:=Application.ThisWorkbook.Path & "\stock_" & i
        .Close False
    End With
Next
Set ws = Nothing
Application.ScreenUpdating = True
End Sub
 
Hi,

Thank you very much for this! Its been a massive help.

Is there any way to script it so cell A1 always says 'sku' and B1 always says 'qty' in every file.

Also, would it be possible to script so all files are saved as .CSV?

Thanks again.
 
Hi Deepak,

Hope you are well.

Is there anyway it could be adjusted to save in UTF-8 .CSV format?

Kind regards
 
Hi @jaiveer ,

You are requested to start to start a new thread for the issue " save in UTF-8 .CSV format " as this is a bit complicated issue & that will help others also.
 
Back
Top