Macro randomly fails

Danny318

New Member
Joined
Jun 19, 2007
Messages
44
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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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
 
Upvote 0
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.
 
Upvote 0
@BSALV Useful advice as that was about not needing to select, it wasn't actually responding to the question. @Danny318 Did the macro start working again after you did as BSALV suggested, or, something else?
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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