如何用VBA在excel中写公式?

我要用vba在excel中写公式,如a10=sum(ai,aj),其中i,j是变量,要在运行中才确定.
该公式要如何写?
[66 byte] By [snowsfox-雪山飞狐] at [2007-12-16]
# 1
Sheets("sheet1").Cells(10, 1) = "=Sum(a" & i & ", a" & j & ")"
sxfwang at 2007-10-15 > top of Msdn China Tech,其他开发语言,Office开发/VBA...
# 2
cells(1,1)="=sum(" & toLetter(col1) & row1 & ":" & toLetter(col2) & row2 & ")"

function toLetter(col as integer) as string
toLetter=vba.chr$(vba.asc("a")+col-1)
end function

注意: toLetter()只能转换26列以内的数字,如果要200列以上的,自己写一个转换函数吧
zephyr_zhao-zephyr at 2007-10-15 > top of Msdn China Tech,其他开发语言,Office开发/VBA...