I wrote some VBA to copy a range from a worksheet and paste it as values to another worksheet in the same workbook. It failed with error 1004. I set the macro recorder running and collected the code generated when I performed the operation by hand. As a stand-alone macro, it worked without error. When I appended these lines of code unaltered to my existing macro, error 1004 again appeared. After some trial and error, I found that if I segregated the copy/paste to a subroutine and called it with the source range as a parameter, it ran without error. So, summarising:
....fails with error 1004. But:![]()
Please Login or Register to view this content.
Test(r)
..runs without error, when Test is defined as:
![]()
Please Login or Register to view this content.
What is going on?
Bookmarks