Cómo acelerar las macros de VBA
Estoy generando nuevas hojas usando macros. Para una nueva generación de hojas, los datos se recuperan de más de 4 MS Access DB. Cada DB tenía un mínimo de 200 campos. Mi código macro incluye
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
Mi problema es que cada generación de hojas tarda un mínimo de una hora en completar el proceso de perforación. Pero me parece que está tardando demasiado.
Ya estoy agregado elApplication.ScreenUpdating = True
acelerar el código, pero aún así lleva el mismo tiempo. Cómo acelerar el código. Si tienes alguna idea, guíame.
`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
Gracias por adelantado