Excel Performance Form control vs Event / Call -


i have script like:

sub pivpaint() clearclipboard dim amaxrows long dim long  amaxrows = 192  = 2 amaxrows starttime = timer    cells(i, "a").interior.color = rgb(255, 255, 0)    cells(i, "ac").value = 1 endtime = timer debug.print "loop " & & "/" & j & ": " & (endtime - starttime) next end sub 

i dont have performance issues until open workbook or include script in workbook filled graphs , ranges linked images. know when script gets slower. funny thing if start script via control button, runs in no time. running button_click() of activex control or calling in event workbook_newsheet() or own module in debug mode makes slower

179-192 form , 2-8 activex button

  • loop 179/: 0,015625
  • loop 180/: 0
  • loop 181/: 0
  • loop 182/: 0,015625
  • loop 183/: 0
  • loop 184/: 0
  • loop 185/: 0,015625
  • loop 186/: 0
  • loop 187/: 0
  • loop 188/: 0
  • loop 189/: 0
  • loop 190/: 0
  • loop 191/: 0
  • loop 192/: 0
  • loop 2/: 0,1875
  • loop 3/: 0,171875
  • loop 4/: 0,1875
  • loop 5/: 0,171875
  • loop 6/: 0,1875
  • loop 7/: 0,1875
  • loop 8/: 0,171875

so know operation can done , want every time. whats difference in calling routine of these 2 buttons.

ps. know code faster if mark simple range, i've "if clause" included. through analyzing code´, found change of color , value responsible delay.

i hope can help! thank in advance

edit1: turning linked pictures on/off jan karel pieterse did here, i've found work around! - still interested in explanation or better solution.


tl;dr:

  • cause of bad performance graphs , ranges linked images
  • performance while running script form control button
  • performance bad while running event, call, activex button
  • how can run script i'm using form control?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -