Results 1 to 5 of 5

Thread: [RESOLVED] Exporting an array formula

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Resolved [RESOLVED] Exporting an array formula

    I have a worksheet that has an array formula that begins with
    =IF(_xlfn._xlws.FILTER('Support - TAM'!H:L,('Support - TAM'!L:L="Complete")

    When I copy that sheet to another workbook it shows up with the name of my source workbook like this. How do I prevent that?
    =IF(_xlfn._xlws.FILTER('[Test.xlsm]Support - TAM'!H:L,('[Test.xlsm]Support - TAM'!L:L="Complete")

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,264

    Re: Exporting an array formula

    Have you tried hitting F2 (Edit-Mode) before Copy/Pasting?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

  4. #4

  5. #5
    Addicted Member
    Join Date
    May 2021
    Posts
    131

    Re: [RESOLVED] Exporting an array formula

    Alternatively, you could use:

    Code:
    TargetWS.UsedRange.Formula = SourceWS.UsedRange.Formula
    By way of (unnecessarily long) example:

    Code:
    Sub TransferFormulas()
        
        Dim SourceWS As Worksheet, TargetWS As Worksheet
        Dim SourceWB As Workbook, TargetWB As Workbook
        Dim TempState As Boolean
        
        Set SourceWB = Application.Workbooks("SourceWorkbook.xlsx")
        Set TargetWB = Application.Workbooks("TargetWorkbook.xlsx")
        
        Set SourceWS = SourceWB.Sheets("CopyMe")
        SourceWS.Copy After:=TargetWB.Sheets(TargetWB.Sheets.Count)
        Set TargetWS = TargetWB.Sheets(TargetWB.Sheets.Count)
        
        TempState = Application.DisplayAlerts
        Application.DisplayAlerts = False
        TargetWS.UsedRange.Formula = SourceWS.UsedRange.Formula
        Application.DisplayAlerts = TempState
        
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width