como acelerar as macros do VBA
Estou gerando novas planilhas usando macros. Para uma nova geração de planilha, os dados são recuperados de mais de 4 bancos de dados do MS Access. Cada banco de dados tinha no mínimo 200 campos. O código My Macro inclui
1. Cell locking
2. Alignment and formatting
3. One third of the cells in the sheet had a formulas
4. Cell reference with other Workbooks
Meu problema é que toda geração de folhas leva no mínimo uma hora para concluir o processo de perfuração. Mas parece-me que está demorando muito.
Eu já adicionei oApplication.ScreenUpdating = True
para acelerar o código, mas ainda leva o mesmo tempo. Como acelerar o código, se você tem alguma idéia, por favor me guie.
`For Ip = 5 To 150
resp = Range("B" & Ip).Value
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=henkel2;DBQ=C:\Hl-RF\RSF-Temp.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;" _
, Destination:=Range("IV4"))
.CommandText = "select Vles from " & Shtname & " where cint(PrductID)='" & resp & "' and cint(DepotID) = '" & cnt1 & "' and Mnth = '" & mnths & "' and Type='" & typs & "'"
.Name = "tab product"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceConnectionFile = _
"C:\Hl-RF\tabct.odc"
.Refresh BackgroundQuery:=False
End With`
Is There Is any way to Reduce the loop iteration time
Desde já, obrigado