Posts by Wilhelm

    Dear forum! I'm new to VBA but and this is my first post here :)


    What I'm trying to do is to copy a sheet from a closed workbook to my active workbook.

    When I run the macro I receive an error message (run-time error '-2147221080 (800401a8)'), however it works the second time.


    The "error line" when debugging is:

    closedBook.Sheets("INSERT_Arbetsgivaravgifter").Copy y.Sheets(1)


    When formulation my code I got expired from:

    https://www.automateexcel.com/vba/copy-worksheet/

    However, instead of using "ThisWorkbook", I'm trying to use active workbook instead since the vba code is in another workbook.


    Thanks in advance for any help :)




    End Sub