Macro randomly fails

Danny318

New Member
Joined
Jun 19, 2007
Messages
42
I have a macro that usually works fine but lately it's been randomly failing on different tabs. The macro essentially just copies and pastes data from one sheet to another and then stops on tab called "dashboard" for viewing. Getting an error code saying "Invalid Forward Reference, or reference to uncompiled type". Why would it work for days in a row and then all of sudden fail? When we resurrect an older version of the source spreadsheet, the macro starts working again. Please let me know if you need more information. Help is appreciated!


Code.png

minisheet pic.png
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

BSALV

Banned user
Joined
Oct 31, 2010
Messages
1,651
Office Version
  1. 365
  2. 2013
  3. 2007
hello,
you 'd avoid to use select, that slows down the macro and has no added value.
I see a refreshall (bizar, without capitals) in front), so just a guess, add a "DoEvents" just in front and just behind that "Refreshall"-line.

Activesheet.paste

Doevents
activeworkbook.refreshall
Doevents

Sheets("Dashboard").select
 

Danny318

New Member
Joined
Jun 19, 2007
Messages
42
hello,
you 'd avoid to use select, that slows down the macro and has no added value.
I see a refreshall (bizar, without capitals) in front), so just a guess, add a "DoEvents" just in front and just behind that "Refreshall"-line.

Activesheet.paste

Doevents
activeworkbook.refreshall
Doevents

Sheets("Dashboard").select
Thanks! Are you saying just drop the word "select"? We use that command to tell the macro to move from one tab to another. We have several tabs that we paste data into.
 

Forum statistics

Threads
1,175,735
Messages
5,899,164
Members
434,751
Latest member
Denis_B

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
Top