I am having a torrid time trying to get this line of code to work when called from two different locations.
I've been through and checked that the inputs are identical from the two places, and that the "Data" page is unprotected in both cases, so I just don't understand why it is working for one and not the other.
On closer inspection it appears that the copy is actually working - I am left with values rather than formulas - but it is throwing a "Run-time error '1004': Application-defined or Object-defined error” and preventing the process from continuing for the user. If I debug and rem out the line after the error has occurred the values are there in the table.
I'm using this copy approach rather than going via the clipboard as I've been struggling with resource issues and I think this is the most efficient and quickest way to do the copy - but please make other suggestions if I'm wrong on this. Maybe I can just suppress the error message and force the process to continue?
Here's the code ...
Sheets("Data").Range(paste_range) = Sheets("Data").Range(paste_range).Value
Thanks for your help!
I've been through and checked that the inputs are identical from the two places, and that the "Data" page is unprotected in both cases, so I just don't understand why it is working for one and not the other.
On closer inspection it appears that the copy is actually working - I am left with values rather than formulas - but it is throwing a "Run-time error '1004': Application-defined or Object-defined error” and preventing the process from continuing for the user. If I debug and rem out the line after the error has occurred the values are there in the table.
I'm using this copy approach rather than going via the clipboard as I've been struggling with resource issues and I think this is the most efficient and quickest way to do the copy - but please make other suggestions if I'm wrong on this. Maybe I can just suppress the error message and force the process to continue?
Here's the code ...
Sheets("Data").Range(paste_range) = Sheets("Data").Range(paste_range).Value
Thanks for your help!