create copy of workbook and clear some data in created workbook

  • I need a macro on button click that will create copy of active workbook, clear some cells in first 3 sheets of this copy file and save it. Before saving it also removes filtermode on sheet "sul".


    I wrote this code. It creates copy of workbook but doesn't clears cells at all and doesn't removes filtermode in copy file. After code execution copy file is open and source file is closed.
    Please help to correct it. Thanks.


  • Re: create copy of workbook and clear some data in created workbook


    Try this

  • Re: create copy of workbook and clear some data in created workbook


    royUK


    Thank you for your reply.



    I've already corrected it by changing SavAs on SaveCopyAs and it works.



    But your code is smarter.



    If I knew that in this case new workbook was an Activeworkbook I'd also use With ActiveWorkbook instead of this long rows of code.


    Thank you again. I study much using your examples. :)

Participate now!

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