vba - Split file in excel for avoiding row limit -
i have .all file exceeds limit of 1048576 rows imposed excel.
im using code:
sub open() book1 = activeworkbook.name file1 = application.getopenfilename("all files (*.all), *.all") worksheets("res").range("k1").value = file1 workbooks.opentext file1, origin:=xlwindows, startrow:=1, datatype:=xltextformat del = activeworkbook.name activesheet.copy before:=workbooks(book1).sheets(1) workbooks(del).close false sheets(1).activate activesheet.name = "acti" end sub
but code doesent work long files because limit. idea copy original .all file, split copy in files limited 1048576 rows, copy each of splited files in individual sheet , revome copies.
im pretty new in vba...any write code?
thank much.
you can split file separate parts using code below.
public sub split_wb() dim integer, arr variant, wb variant, ws_source worksheet set ws_source = activesheet = 1 5 arr = ws_source.range("a" & * 1000 - 999 & ":t" & * 1000) set wb = workbooks.add wb.sheets(1).range("a1").resize(ubound(arr, 1), ubound(arr, 2)).value = arr set arr = nothing next end sub
also, i'd recommend looking using access or sql server, if excel can't handle demands.
Comments
Post a Comment