DataModel tables do not refresh with VBA Thisworkbook.Model.Refresh

OrbitBank

New Member
Joined
May 6, 2019
Messages
1
Excel 2016


I have a DataModel that is fed from 9 Excel tables (notPowerQuery). I use VBA to run SQLqueries and dump the results into these 9 tables and then refresh the DataModelwith Thisworkbook.Model.Refresh.


However, not all the tables refresh their data and am at a lossas to how to correct. I’ve verified thatthe raw Excel tables are updating, and even put in calculated columns to theDataModel tables with a simple Now() calculation to check when the DataModel tablesrefresh. The Now timestamp updates onthe DataModel tables but the data from the Excel tables does not get passed/pushedinto the DataModel.



Events, calculations, and screenupdating are turned off atthe start of the macro, but events and calculations are turned back on prior tothe refresh. I’ve tried wrapping therefresh in DoEvents as well.


The only thing that works is to run Thisworkbook.Model.Refreshback to back.




 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top