DataBlake
Well-known Member
- Joined
- Jan 26, 2015
- Messages
- 781
- Office Version
- 2016
- Platform
- Windows
I'm struggling with the logic behind this statement
I assign an entire sheet to an array
then i want
for every 1500 rows
write those values to new sheets
include header/insert header
save as csv (comma delimited) and close sheet
next 1500 rows
This is to happen until there are no rows left and the last sheet will be under 1500
My attempt:
My brain is not comprehending how to loop through the array as 1500
any help would be appreciated
I assign an entire sheet to an array
then i want
for every 1500 rows
write those values to new sheets
include header/insert header
save as csv (comma delimited) and close sheet
next 1500 rows
This is to happen until there are no rows left and the last sheet will be under 1500
My attempt:
Code:
Dim ary1 as Variant
Dim ws as WorkSheet
Dim i as Long
Dim x as Long
'establish sheet, array, and last column of activesheet
Set ws = ActiveSheet
ary1 = ws.Range("A1").CurrentRegion.Value2
lastCol = openWB.Sheets(1).Range("A1").SpecialCells(xlCellTypeLastCell).Column
'loop through array by rows
for i = 1500 to UBound(ary1)
'for every 1500 rows of the array what do?
Sheets.Add (After:= ws)
'ActiveSheet.Range("A1").Resize(???(ary1), lastCol).Value = ary1
Dim fold As String: fold = "C:\Users\user\Desktop\"
Dim fName As String: fName = "newSHEET"
With ActiveWorkbook
.SaveAs fold & fName & Format(Date, "MM-DD-YYYY") & ".csv", FileFormat:=xlCSV
.Close False
End With
ActiveSheet.Delete
My brain is not comprehending how to loop through the array as 1500
any help would be appreciated