Dim mSht As Worksheet
Dim mRng As Range
Dim mRng1 As Range
Dim mRng2 As Range
Set mSht = Worksheets(1)
With mSht
Set mRng = .Range("b9")
Set mRng1 = Range("mysum").Cells(2, 2)
'MsgBox mRng1.Address
Set mRng2 = Range("mysum").Cells(8, 2)
'MsgBox mRng2.Address
'mRng.Formula = "=sum(mrng1 &":"& mrng2)" '第一種語法
'mRng.Formula= "sum(range("mysum").cells(2,2) &":"& range("mysum").cells(8,2)) '第二種語法
End With
End Sub
感謝各位大大。作者: oobird 時間: 2010-9-19 17:16
a = Range("mysum")(2, 2).Address
b = Range("mysum")(Range("mysum").Count).Address
[b9] = "=sum(" & a & ":" & b & ")"作者: dechiuan999 時間: 2010-9-20 06:43
謝謝版主大大。
小弟引用大大的語法已達成須求。
目前尚在研究是否有其他語法可適用呢。
感恩版主大大!作者: et5323 時間: 2010-9-20 08:44
With Range("mySum").Columns(2)
[b9] = Application.Sum(.Value) - .Cells(1, 1)
End With
With Range("mySum").Columns(2)
[b10] = Application.Sum(.Cells(2, 1).Resize(.Rows.Count - 1, 1))
End With作者: GBKEE 時間: 2010-9-20 13:12