Hi,
This is my first post and I hope I can get some good feedback.
I am running a giant for loop with many excel calculations, where the finalized product will be a sheet to export, named ExportSheet. The range in this sheet is only changing with the amount of rows set by "LastRow", but the columns stays the same.
The export sheet is then set to be exported into an Access Table where it will be stored in the database. My problem is that this export code is taking very long time and I am now looking for ways to improve it. I hope this is within your boundaries even though its including Access and not only Excel. A normal ExportSheet would include a range of 35 x 2500 cells all filled with data. Why I want it to run faster is because its part of a really large for loop. The loop posted below is just an example to show you the logic behind it.
Dim acc As New Access.Application
acc.OpenCurrentDatabase "N:\blabla\MarketingCostDataBase.accdb"
'________________________________________________________
For x=1 to 10
acc.DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel12Xml, _
ExportID, _
Application.ActiveWorkbook.FullName, _
True, _
"ExportSheet$A3:AH" & LastRow _
Next x
'________________________________________________________
acc.CloseCurrentDatabase
acc.Quit
Set acc = Nothing
So for my questions:
What way is the fastest to transfer data from Excel to Access?
Any improvements I can do to my VBA code to make the export process run faster?
Thank you in advance and let me know if I expressed myself too unclear.
Bookmarks