Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2010
    Location
    Denver, CO
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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 {=(D5250)/$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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array formula in VBA (Excel 2002 (xp) SP2)

    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 = "=(D5250)/$D$5"

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

  3. #3
    2 Star Lounger
    Join Date
    Feb 2010
    Location
    Denver, CO
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array formula in VBA (Excel 2002 (xp) SP2)

    I love this board and the quick responses. Thanks, Hans!

Posting Permissions

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