Range.Select results in error if running macro from another workbook

  • Here's my problem, I have a very basic line in my macro:
    Range("K2").Select


    But, the macro gives me an "application-defined or object-defined error" if I run the macro from a different workbook, than the active one?


    I tested this, my macro swaps between two workbooks, and different Range.Select lines work if I transfer the whole macro to another workbook.

  • Re: Range.Select results in error if running macro from another workbook


    Don't select the range. Selecting ranges is rarely necessary and slows your code down

  • Re: Range.Select results in error if running macro from another workbook


    edit: solved, I just had to insert the macro on a workbook level, not sheet level. Wierd.

  • Re: Range.Select results in error if running macro from another workbook


    You aren't explicitly setting the sheets to copy from/to. You're using activesheet, what if the wrong sheet is active?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!