I have a macro button on one worksheet (call it Sheet1), which (as part of its process) tries to copy (and paste) a range of cells on another worksheet (call it OtherSheet). The macro uses row and column numbers to define the copy range. I started with a statement like this:
That gave me a runtime Error 1004. So I tried this:Please Login or Register to view this content.
This gives the same Error 1004 (on the line with the Set command). I accidentally discovered, however, that if I run the macro from within the VBA editor, while OtherSheet (not Sheet1) is the active sheet, that it runs OK. If Sheet1 is the active sheet, it fails.Please Login or Register to view this content.
So what's going on? I'm specifically referencing the worksheet to copy from (OtherSheet). Why does it care which sheet is active? How can I get it to work when OtherSheet is not the active sheet?
Bookmarks