View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Martin Los[_3_] Martin Los[_3_] is offline
external usenet poster
 
Posts: 22
Default Posible to speed up query update with Apllication.screenupdating?

I have a 8 sheets with each 8 queries.

I use this macro to actualize all queries:

Sub ActualizarConsultas()
Dim QueryTables As QueryTables
Dim query As QueryTable
Dim ws As Worksheet
Dim i As Integer
Dim vArray As Variant
Dim dteFecha As Date
Dim j As Long

With Application
' .ScreenUpdating = False
.Calculation = xlCalculationManual
End With
'Define names of sheets with queries to be updated
vArray = Array("Brand1", "Brand2", "Brand3", "Brand4", "Brand5", "Brand6",
"Brand7", "Brand8")

'Update queries
For i = 0 To UBound(vArray)
Set ws = Worksheets(vArray(i)) 'Select sheet
For Each query In ws.QueryTables
query.Refresh BackgroundQuery:=False 'Update query
Next
Next
With Application
' .ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
'MsgBox "Terminado", vbInformation, "END"
End Sub

I am afraid to use .ScreenUpdating = True. Could that not cause one query to
overwrite rows of the query right below it because the screen does not update?

TIA

Martin