Copy 2 Sheets And Close

  • Thanks to the help from this Forum and its members: I can now open a file and copy two sheets but need to close the second file...


    In wkb "C*commissions database.xls" I have this code which directs the user to open the current month's commissions. And with it open I can copy two sheets (always named the same). but now I need to close the current month's workbook, so I can continue working with the data in my permenant workbook.



    Thank you for taking the time to read this, hope you can give me a suggestion. Charles

  • Re: Copy 2 Sheets And Close, variable Wbk Names


  • Re: Copy 2 Sheets And Close, variable Wbk Names


    Yes, thank you.


    This is going to work, it doesn't yet, but I'm sure it will.


    After it copies the sheets to:
    MyWrkbkName, MyWrkbkName is active and it does not close either


    I think if we could make NewWrkbkName active, we could close it (and not save changes)


    Could you suggest a line of code to activate the NewWrkbkName?

  • Re: Copy 2 Sheets And Close, variable Wbk Names


    WE got it working!:p I say "WE" because I could not have done it alone...Thank you so much!


    right after the dialogbox I inserted this line:
    NewWrkbkName = ActiveWorkbook.Name


    then after I copied the sheets I inserted this line:
    Workbooks(NewWrkbkName).Activate


    looks like this now:

Participate now!

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