excel - Running out of VBA Memory -


im running code below, want to. issue having though when keep sheet running period of time 10 min pop error message saying have run out of memory.

is there put in code use prevent this?

my code below,

sub auto_open()     call schedulecopypriceover end sub   sub schedulecopypriceover()     timetorun = + timevalue("00:00:10")     application.ontime timetorun, "copypriceover" end sub  sub copypriceover() dim lrow    long dim ws      worksheet  set ws = thisworkbook.sheets("orders")   application.screenupdating = false        srow = 1 5000     if ws.cells(srow, 19) = srow         ws.cells(srow, 12).select         activecell.formular1c1 = "ready"         call schedulecopypriceover       elseif ws.cells(srow, 20) = srow         ws.cells(srow, 12).select         activecell.formular1c1 = "cancel"       end if     next      call schedulecopypriceover    end sub  sub auto_close()     on error resume next     application.ontime timetorun, "copypriceover", , false end sub 

your overflow being caused many scheduled events.

in loop, scheduling ontime if row has row number value in column s. scheduling 1 more ontime if no rows have row number in column s.

so, if 200 of 5000 rows have matching value, setting 201 scheduled calls macro in 10 seconds time. when 201 events fire, might (depending on has happened within 10 seconds) generate 40000+ events. (even if there one row column s's value matching row number, after 10 minutes end on 1,000,000,000,000,000,000 events being queued.)

there no need reschedule copypriceover code more once, remove call schedulecopypriceover within loop.

for srow = 1 5000     if ws.cells(srow, 19).value = srow          ws.cells(srow, 12).formular1c1 = "ready"         'get rid of next line         'call schedulecopypriceover      elseif ws.cells(srow, 20).value = srow          ws.cells(srow, 12).formular1c1 = "cancel"      end if next  call schedulecopypriceover 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -