Macro to allow location and change file type to XLS

  • hi guys,


    Can someone help me, I am looking for a code which will copy output1 and output2 tab from existing worksheet into new worksheet and save the file as XLS.


    it should also give the user option to save the file in user define folder and name as they need.


    below is my attempt but its does not work and keeps crashing on "Worksheets(Array("Output 1", "Output 2")).Copy"


  • Re: Macro to allow location and change file type to XLS


    Hello
    Try this code

  • Re: Macro to allow location and change file type to XLS


    Thanks BaraaKhalil, however I want use to select the path and name the workbook and not define this in the macro. Also I want to save this as xls not xlsm.

  • Re: Macro to allow location and change file type to XLS


    As for saving as xls .. Just replace 52 with 56
    As for the first point, I have no idea what you are talking about .. Do you need dialog box to determine the path or what?

  • Re: Macro to allow location and change file type to XLS


    I have the below code (from Ron de Bruin website) which I have tried to modify but I get type miss match on "Sheets(Array(Output1, O2)).Copy" line. Can someone look into this?


  • Re: Macro to allow location and change file type to XLS


    anyone who tell me why I am getting type missed match at the array formula?

  • Re: Macro to allow location and change file type to XLS


    I think this line

    Code
    Sheets(Array(Ouput1,O2)).Copy


    Output1 would be put between quotation marks and the same for O2

    Code
    Sheets(Array"Output1","O2")).Copy
  • Re: Macro to allow location and change file type to XLS


    tried changing this comes with error "Run-time error 91: Object variable or with block variable not set"

  • Re: Macro to allow location and change file type to XLS


    What is the variable varResult?


    Are you trying to remove the formulas in both sheets of the new file and leave just the value that is the result of each formula?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

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