From: sgltaylor on
Hi,

I am trying to figure out how to do the following:

Assume you have a formula like sum (A1:A5) in cell A6.
What I need to do is add a sumproduct formula to the existing formula
using vba.
For example, the formula in cell A6 will be updated to sum(A1:A5)/
SUMPRODUCT((C4:C8=B1)*(D4:D8=B2))

Any ideas or suggestions.

Thanks,

Steve
From: Don Guillett on
Basic idea. Modify to suit

Sub addtoformulawithvba()
With ActiveCell
MsgBox .Formula
..Formula = .Formula & "+d2"
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1(a)austin.rr.com
"sgltaylor" <stvn.taylor(a)gmail.com> wrote in message
news:9d578204-d24c-4fc0-a3d2-e76bd15dba3f(a)a10g2000pre.googlegroups.com...
> Hi,
>
> I am trying to figure out how to do the following:
>
> Assume you have a formula like sum (A1:A5) in cell A6.
> What I need to do is add a sumproduct formula to the existing formula
> using vba.
> For example, the formula in cell A6 will be updated to sum(A1:A5)/
> SUMPRODUCT((C4:C8=B1)*(D4:D8=B2))
>
> Any ideas or suggestions.
>
> Thanks,
>
> Steve