View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default SUMIFS in Programming

Maybe simply this -

dim sf as string

sf = "=SUMIFS(R15C14:R600C14,R15C13:R600C13,R2C,R15C4:R 600C4,R3C35)"
Range("AK3:AR3").FormulaR1C1 = sf

but note a very subtle difference with the relative addressing, which if you
manually want to extend I suspect will work better for you. Ie R2C vs R2Cn

Otherwise -

s1 = "=SUMIFS(R15C14:R600C14,R15C13:R600C13,R2C"
s2 = ",R15C4:R600C4,R3C35)"

For n = 37 To 44
sf = s1 & n & s2
Cells(3, n).FormulaR1C1 = sf
Next

Regards,
Peter T


"Graham" wrote in message
...
Below is waht ideally I would like to do with a procedure and I know this
will not work with n in a formula, it was just to show the concept of what
I was after.
I would appreciate any guidance.

Graham


For n = 37 To 44

Cells(3, n).Select

ActiveCell.FormulaR1C1 = _

"=SUMIFS(R15C14:R600C14,R15C13:R600C13,R2Cn,R15C4: R600C4,R3C35)"

Next n