Reputation: 813
I have a piece of code that has been working great but suddenly stopped working and I can't figure out what changed.
I have a template worksheet that has a few charts and calculations. I copy this template worksheet and paste in any new data so that it easily does all the calculations and plotting with minimal effort. However, today when I was testing some new features that have nothing to do with this operation (as far as I can tell), it stopped working. Now the charts no longer exist on the copy of the worksheet. This happens whether I copy the worksheet using VBA or manually.
I saw a similar issue on a co-workers computer months ago but figured it was due to an older version of Windows/Office. This same co-worker now uses this worksheet without issue but I never figured out what changed that got rid of the error for them. Does anyone know what could cause this behavior? I have tried restarting my computer, restarting Excel, and even trying an older revision of the worksheet that I know worked but the issue persists. The charts just do not follow the worksheet over when copied, even though I know this used to work. It was a pretty central feature of this worksheet.
Since this happens even without using VBA, I won't include a sample of code. It seems to me it has to be some sort of Excel setting but I can't figure it out. Any help would be appreciated.
Upvotes: 0
Views: 1769
Reputation: 166306
Try
Application.CopyObjectsWithCells = True
before performing the copy.
See Excel Options >> Advanced >> Cut, Copy and Paste >> "Cut, copy and sort inserted objects with their parent cells"
Sometimes that gets unchecked.
Upvotes: 5