• Array formula in VBA (Excel 2002 (xp) SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Array formula in VBA (Excel 2002 (xp) SP2)

    Author
    Topic
    #405569

    I am in need of including an array formula in a spreadsheet I’m creating. In the interface, I would build the formula, then Shft+Ctrl+Enter.

    The problem is that I’m creating the file through VBA. How do I tell it to Shft+Ctrl+Enter?

    More information, in case its needed: The formula is rather simple {=(D5:D250)/$D$5}. I don’t want to copy it individually to a couple hundred rows, so I thought an array might be just the ticket. Any help, as always, is greatly appreciated.

    Viewing 0 reply threads
    Author
    Replies
    • #834221

      Use the FormulaArray property of the cell/range instead of the Formula property.

      Dim rng As Range
      Set rng = … (this is up to you)
      rng.FormulaArray = “=(D5:D250)/$D$5”

      Note that the brackets { } are not part of the formula.

    Viewing 0 reply threads
    Reply To: Array formula in VBA (Excel 2002 (xp) SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: