0

I am making a dashboard. The goal is to query data and refresh the dashboard about every minute.

Employees are working through a continual flow of work.
The dashboard needs to query data, replace the data in the dashboard, refresh the dashboard visual so the change can be seen, wait about a minute, and repeat the process.

It is looping through the iterations but not refreshing. I need this loop to stop once a cycle and display the updates.
It is looping but it is frozen until I press Esc.

Is there any code that can make this loop stop for a second so it can display what has changed since the last loop iteration?

The dashboard is named Summary in the VBA properties.

For cycle_count = 1 To cycles
    Application.ScreenUpdating = False
    Summary.Range("F3").Value = cycle_count
        
    If cycle_count > 1 Then
        Application.Wait (Now + TimeValue("0:00:45"))
    End If
    
    Calculate
        
    SQL_MR.SQL_MR
    SQL_Issues.SQL_Issue_Import
        
    If Not Application.CalculationState = xlDone Then
        DoEvents
    End If
        
    Calculate
        
    Summary_Build.service_window
        
    Application.ScreenUpdating = True
    Summary.Activate
        
Next
Community
  • 1
  • 1
Mitsugi
  • 77
  • 1
  • 1
  • 5
  • 1
    try a **DoEvents** statement after the ScreenUpdating = true – igittr Dec 13 '21 at 17:14
  • Unfortunately this did not work. I thought it was but it didn't. I have a cycle counter on the dashboard and it said "15" and after I pressed ESC it immediately displayed 25. So it wasn't refreshing. Any other ideas? Thanks! – Mitsugi Dec 14 '21 at 01:42
  • is the dashboard on a Form, if so follow the DoEvents with a **Me.Repaint** to hopefully redraw the form. – igittr Dec 14 '21 at 13:37
  • It isn't a form. It's just an excel worksheet. The VBA is clearing contents and inserting values from a refreshed query into the cleared cells. – Mitsugi Dec 14 '21 at 14:44
  • explore this post [https://stackoverflow.com/questions/3735378/force-a-screen-update-in-excel-vba](https://stackoverflow.com/questions/3735378/force-a-screen-update-in-excel-vba) – igittr Dec 15 '21 at 15:11

0 Answers0