Why does my Status Bar stop updating.

ouadad

Board Regular
Joined
Jun 19, 2005
Messages
213
I'm running a simulation with over 500,000 iterations. I've got screenupdating turned on on, statusBar display is on, and I've activated the status bar to print on the iteration number, but it prints out 6000+ and then stops. Could it be that the software is running faster than the screen can update the status bar?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
answering your question: no It can be the variable. You can put all your code to review it.
 
Upvote 0
I'm not familiar with DoEvents, but I tried it in my code and it didn't work. Could someone help me fix it please? code is:

Code:
Sub Extract_data_for_Friedman_Test()
Dim year As Integer, avg As Double, mos As Integer, group As Integer, irow As Long, irow2 As Integer, icol2 As Integer
Dim count As Long
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.DisplayStatusBar = True
count = 0
For irow = 2 To 501434
    year = Cells(irow, 1)
    avg = Cells(irow, 2)
    mos = Cells(irow, 3)
    group = Cells(irow, 4)
    For icol = 6 To 2678 Step 8
        If Cells(1, icol) = group Then
            For irow2 = 2 To 139
                If Cells(irow2, icol) = mos Then
                    For icol2 = icol + 1 To icol + 7
                        If Cells(1, icol2) = year Then
                            count = count + 1
                            Cells(irow2, icol2) = avg
                            Application.StatusBar = "Iteration = " & count
                            DoEvents
                            GoTo 10
                        End If
                    Next icol2
                End If
            Next irow2
        End If
    Next icol
10  Next irow
End Sub
 
Upvote 0
Try this.
I tried it and it worked up to 250 thousand and it continued.

Code:
Sub Extract_data_for_Friedman_Test()
Dim year As Integer, avg As Double, mos As Integer, group As Integer, irow As Long, irow2 As Integer, icol2 As Integer
Dim count As Long
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.DisplayStatusBar = True
count = 0
For irow = 2 To 501434
   [COLOR=#0000ff] Application.StatusBar = "Processing = " & irow
    DoEvents[/COLOR]
    year = Cells(irow, 1)
    avg = Cells(irow, 2)
    mos = Cells(irow, 3)
    group = Cells(irow, 4)
    For icol = 6 To 2678 Step 8
        If Cells(1, icol) = group Then
            For irow2 = 2 To 139
                If Cells(irow2, icol) = mos Then
                    For icol2 = icol + 1 To icol + 7
                        If Cells(1, icol2) = year Then
                            count = count + 1
                            Cells(irow2, icol2) = avg
                            Application.StatusBar = "Processing = " & irow & " Iteration = " & count
                            DoEvents
                            GoTo 10
                        End If
                    Next icol2
                End If
            Next irow2
        End If
    Next icol
10  Next irow
End Sub
 
Upvote 0
Being here, I waited for it to end, it took 12 minutes and the meter was always in motion
 
Upvote 0
Thank you. Funny, it only works if I execute the macro while in VBA. It doesn't work if I go through the Excel>macros menu.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top