excel - Generate new worksheet based on column data for LARGE spreadsheets -


i have spreadsheet 800k rows , 150 columns. i'm attempting create new worksheets based on contents of column. so, example if column y has many elements ("alpha", "beta", "gamma", etc.) i'd create new worksheets named "alpha", "beta", "gamma" contain rows original have respective letters. i've found 2 scripts work smaller spreadsheets, due size of particular spreadsheet, don't work.

here 2 scripts have tried:

sub parse_data() dim lr long dim ws worksheet dim vcol, integer dim icol long dim myarr variant dim title string dim titlerow integer vcol = 1        set ws = sheets("sheet1")        lr = ws.cells(ws.rows.count, vcol).end(xlup).row title = "a1:c1"            titlerow = ws.range(title).cells(1).row icol = ws.columns.count ws.cells(1, icol) = "unique" = 2 lr     on error resume next     if ws.cells(i, vcol) <> "" , application.worksheetfunction.match(ws.cells(i, vcol), ws.columns(icol), 0) = 0         ws.cells(ws.rows.count, icol).end(xlup).offset(1) = ws.cells(i, vcol)     end if next myarr = application.worksheetfunction.transpose(ws.columns(icol).specialcells(xlcelltypeconstants)) ws.columns(icol).clear = 2 ubound(myarr)     ws.range(title).autofilter field:=vcol, criteria1:=myarr(i) & ""     if not evaluate("=isref('" & myarr(i) & "'!a1)")         sheets.add(after:=worksheets(worksheets.count)).name = myarr(i) & ""     else         sheets(myarr(i) & "").move after:=worksheets(worksheets.count)     end if     ws.range("a" & titlerow & ":a" & lr).entirerow.copy sheets(myarr(i) & "").range("a1")     sheets(myarr(i) & "").columns.autofit next ws.autofiltermode = false ws.activate end sub 

this returns "overflow"

the other code have tried:

sub columntosheets()  const sname string = "voterfile_withabsenteeinformati" 'change whatever starting sheet const s string = "o" 'change whatever criterion column dim d object, a, cc& dim p&, i&, rws&, cls& set d = createobject("scripting.dictionary") sheets(sname)     rws = .cells.find("*", , , , xlbyrows, xlprevious).row     cls = .cells.find("*", , , , xlbycolumns, xlprevious).column     cc = .columns(s).column end each sh in worksheets     d(sh.name) = 1 next sh  application.screenupdating = false sheets.add(after:=sheets(sname))     sheets(sname).cells(1).resize(rws, cls).copy .cells(1)     .cells(1).resize(rws, cls).sort .cells(cc), 2, header:=xlyes     = .cells(cc).resize(rws + 1, 1)     p = 2     = 2 rws + 1         if a(i, 1) <> a(p, 1)             if d(a(p, 1)) <> 1                 sheets.add.name = a(p, 1)                 .cells(1).resize(, cls).copy cells(1)                 .cells(p, 1).resize(i - p, cls).copy cells(2, 1)             end if             p =         end if     next     application.displayalerts = false     .delete     application.displayalerts = true     application.screenupdating = true end sheets(sname).activate  end sub 

returns error "excel not have enough resources".

is possible want on hardware?

you can refer modified subroutine in article 'macro copying , pasting data worksheet'.

sub copysheet()  dim wsall worksheet dim wscrit worksheet dim wsnew worksheet dim lastrow long dim lastrowcrit long dim long  set wsall = worksheets("all") ' change name of worksheet existing data on  lastrow = wsall.range("a" & rows.count).end(xlup).row  set wscrit = worksheets.add  ' column g has criteria eg project ref wsall.range("a1:a" & lastrow).advancedfilter action:=xlfiltercopy, copytorange:=wscrit.range("a1"), unique:=true  lastrowcrit = wscrit.range("a" & rows.count).end(xlup).row = 2 lastrowcrit       wsall.copy before:=sheets("all")      activesheet.name = wscrit.range("a2")      range("a1").currentregion.advancedfilter action:=xlfilterinplace, criteriarange:=wscrit.range("a1:a2"), _      unique:=false      wscrit.rows(2).delete  next  application.displayalerts = false wscrit.delete application.displayalerts = true  end sub 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -