One way:
Option Explicit
Sub CreateFiles()
Dim CurWks As Worksheet
Dim NewWks As Worksheet
Dim iRow As Long
Dim myStep As Long
Dim myFolderName As String
Dim wCtr As Long
myFolderName = "C:\temp\"
Set CurWks = Worksheets("sheet1")
Set NewWks = Workbooks.Add(1).Worksheets(1)
myStep = 35
wCtr = 0
With CurWks
For iRow = 1 To .Cells(.Rows.Count, "A").End(xlUp).Row Step myStep
NewWks.Cells.Clear 'just in case
.Rows(iRow).Resize(myStep).Copy _
Destination:=NewWks.Range("a1")
wCtr = wCtr + 1
Application.DisplayAlerts = False
NewWks.Parent.SaveAs _
FileName:=myFolderName & Format(wCtr, "0000") & ".csv", _
FileFormat:=xlCSV
Application.DisplayAlerts = True
Next iRow
End With
NewWks.Parent.Close savechanges:=False
MsgBox "Done."
End Sub
make sure that your folder that gets the files already exists. I used c:\temp.
wrote:
Hi,
I need to take a large (many rows, few columns) worksheet and split it
up into a bunch of csv files that can be no longer than 35 rows (the
server application we are uploading them to can only take 35 rows at a
time). Can anyone point me in the right direction? I have programming
experience but don't work much with Excel.
Thanks for your time and consideration,
Jack
--
Dave Peterson