Add to an Existing formula in a Cell using VBA

S

sgltaylor

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
 
D

Don Guillett

Basic idea. Modify to suit

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top