vba - Macro doesn't work after 32367 lines in 2010 excel -


i have 90,000+ lines of data consolidate. code works fine 25k lines or so. when there more data, stops @ 32267 line , says object error.

i have referred few of stackoverflow reviews on same model. answers in them didn't concern.

my code

sub macro_consolidator()  dim spendsheet worksheet dim outputsheet worksheet dim long dim spendlastrow long dim outputlastrow long dim spendid string dim outputidrow variant dim ctsheet worksheet dim sh worksheet, flg boolean application.screenupdating = false  set spendsheet = thisworkbook.sheets("sheet1") each sh in worksheets if sh.name "output" flg = true: exit next if flg = false dim ws worksheet set ws = thisworkbook.sheets.add(after:=thisworkbook.sheets(thisworkbook.sheets.count)) ws.name = "output"     set outputsheet = thisworkbook.sheets("output")    set spendsheet = thisworkbook.sheets("sheet1")     spendlastrow = spendsheet.usedrange.rows.count    outputlastrow = outputsheet.usedrange.rows.count      = 4 spendlastrow       spendid = cstr(spendsheet.cells(i, 3)) + cstr(spendsheet.cells(i, 4)) + cstr(spendsheet.cells(i, 5)) + cstr(spendsheet.cells(i, 6)) + cstr(spendsheet.cells(i, 10)) + cstr(spendsheet.cells(i, 15)) + cstr(spendsheet.cells(i, 16))  outputidrow = application.match(spendid, outputsheet.columns(35), 0)     if not iserror(outputidrow)             outputsheet.cells(outputidrow, 11) = spendsheet.cells(i, 14)             outputsheet.cells(outputidrow, 12) = outputsheet.cells(outputidrow, 12) + spendsheet.cells(i, 13) ' actual spend - addition wit previous              if spendsheet.cells(i, 1) = "corporate"             msgbox (outputidrow):             outputsheet.cells(outputidrow, 14) = outputsheet.cells(outputidrow, 14) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "ccp"                  outputsheet.cells(outputidrow, 13) = outputsheet.cells(outputidrow, 13) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 2"                  outputsheet.cells(outputidrow, 15) = outputsheet.cells(outputidrow, 15) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 3"                 outputsheet.cells(outputidrow, 16) = outputsheet.cells(outputidrow, 16) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 3e"                 outputsheet.cells(outputidrow, 17) = outputsheet.cells(outputidrow, 17) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 5"                 outputsheet.cells(outputidrow, 18) = outputsheet.cells(outputidrow, 18) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 6"                 outputsheet.cells(outputidrow, 19) = outputsheet.cells(outputidrow, 19) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 7"                 outputsheet.cells(outputidrow, 20) = outputsheet.cells(outputidrow, 20) + spendsheet.cells(i, 9)             end if                ' msgbox (outputsheet.cells(3, 13))      else         outputlastrow = outputlastrow + 1         outputsheet.cells(outputlastrow, 35) = spendid         outputsheet.cells(outputlastrow, 1) = spendsheet.cells(i, 2)         outputsheet.cells(outputlastrow, 2) = spendsheet.cells(i, 5)         outputsheet.cells(outputlastrow, 3) = spendsheet.cells(i, 4) ' (i,5)         outputsheet.cells(outputlastrow, 4) = spendsheet.cells(i, 10)         outputsheet.cells(outputlastrow, 5) = spendsheet.cells(i, 16)         outputsheet.cells(outputlastrow, 6) = spendsheet.cells(i, 15)         outputsheet.cells(outputlastrow, 7) = spendsheet.cells(i, 6)         'outputsheet.cells(outputlastrow, 8) = spendsheet.cells(i, 14)        ' outputsheet.cells(outputlastrow, 9) = spendsheet.cells(i, 11)         outputsheet.cells(outputlastrow, 10) = spendsheet.cells(i, 3)         outputsheet.cells(outputlastrow, 11) = spendsheet.cells(i, 14) ' unit price         outputsheet.cells(outputlastrow, 12) = spendsheet.cells(i, 13) ' actual usd         'outputsheet.cells(outputlastrow, 13) = outputsheet.cells(outputlastrow, 13) + spendsheet.cells(i, 19)        ' outputsheet.cells(outputlastrow, 13) = spendsheet.cells(i, 19)              if spendsheet.cells(i, 1) = "corporate"                msgbox (outputlastrow):                 outputsheet.cells(outputlastrow, 14) = outputsheet.cells(outputlastrow, 14) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "ccp"                 outputsheet.cells(outputlastrow, 13) = outputsheet.cells(outputlastrow, 13) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 2"                 outputsheet.cells(outputlastrow, 15) = outputsheet.cells(outputlastrow, 15) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 3"                 outputsheet.cells(outputlastrow, 16) = outputsheet.cells(outputlastrow, 16) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 3e"                 outputsheet.cells(outputlastrow, 17) = outputsheet.cells(outputlastrow, 17) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 5"                 outputsheet.cells(outputlastrow, 18) = outputsheet.cells(outputlastrow, 18) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 6"                 outputsheet.cells(outputlastrow, 19) = outputsheet.cells(outputlastrow, 19) + spendsheet.cells(i, 9)             end if             if spendsheet.cells(i, 1) = "fab 7"                 outputsheet.cells(outputlastrow, 20) = outputsheet.cells(outputlastrow, 20) + spendsheet.cells(i, 9)             end if      end if  next   end sub    


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -