I have a label on a form that I use to show the progress of a loop. It works
great except if I change the focus to a different application and then return
to excel. Doing so freezes the label where it was when I changed the focus.
Is there a to get the form to start refreshing again?
Thanks
For i = 1 To LastRow
lblStatus.Caption = i & " of " & LastRow
frmStatus.Repaint
...the rest of the loop
Next i
Tom Ogilvy - 25 Jan 2006 15:40 GMT
Perhaps
For i = 1 To LastRow
lblStatus.Caption = i & " of " & LastRow
frmStatus.Repaint
doevents
...the rest of the loop
Next i

Signature
Regards,
Tom Ogilvy
> I have a label on a form that I use to show the progress of a loop. It works
> great except if I change the focus to a different application and then return
[quoted text clipped - 8 lines]
> ...the rest of the loop
> Next i
ybazizi - 25 Jan 2006 16:30 GMT
The DoEvents did the trick. Thanks!
> Perhaps
>
[quoted text clipped - 20 lines]
> > ...the rest of the loop
> > Next i
Crowbar - 25 Jan 2006 15:54 GMT
Don't know how useful this is but I found pausing the application works with
things like this, this will pause the loop for half a second that usaully is
more than enough time for the computer to refresh
Dim PauseTime, Start, Finish
For i = 1 To LastRow
PauseTime = 0.5 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
Loop
Finish = Timer ' Set end time.
lblStatus.Caption = i & " of " & LastRow
frmStatus.Repaint
...the rest of the loop
Next i