excel - Application.StatusBar freezes in VBA -
of late have been writing macros require substantial amount of time execute. (upwards of 5 minutes longer). 1 of things found useful in such cases (other wait) have application.statusbar tell me if moving or hung.
however, many times, application.statusbar gets frozen @ value while program moves ahead. how can rectified? there anyway can prevent statusbar keeps moving long program moving? in advance.
i found freeze happens @ code when have many items in loop. got around using following code:
for rownum = 1 totalrows colnum = 1 totalcols 'code if colnum = 1 if rownum mod 50 = 0 , colnum = 1 application.statusbar = format(rownum / totalrows, "0%")& " completed." end if else: exit end if next colnum next rownum
the loop updates status bar once every 50 rows. helped code run lot faster , eliminated screen freezing up
Comments
Post a Comment