VBA Nested For Loop Crashing Excel -


i trying create list of possible combinations of entries 2 separate sheets, whenever try run it, excel crashes after 20 seconds. have tips how make more efficiently, or way make work? thanks!

sub create() dim dates, groups, current integer dim datevalue date dim groupvalue string dim cell long  application.screenupdating = false sheets(3).cells.clear cell = 1  dates = 1 730      sheets(1).select     datevalue = cells(dates, 1).value      groups = 1 155          application.statusbar = datevalue & " " & groupvalue          sheets(2).select         groupvalue = cells(groups, 1).value          sheets(3).select          cells(cell, 1) = datevalue         cells(cell, 2) = groupvalue          cell = cell + 1      next groups  next dates  application.statusbar = false application.screenupdating = true  end sub 

remove .select calls.

groupvalue = sheets(2).cells(groups, 1).value 

is better than

sheets(2).select groupvalue = cells(groups, 1).value 

.select slow , expensive , unnecessary.

does statusbar update? doing 100k times likewise bottleneck; use mod counter update every nth iteration.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -