Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
Sub test() Dim myrange As Range Dim i As Variant Set myrange = Worksheets("Sheet1").Range("A1:A13") i = Application.WorksheetFunction.Sum(myrange) End Sub "Bob Phillips" wrote: VBA works on a range object, i = Application.SUM(Range("Sheet1!A1:Sheet1!A13") -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "Gary''s Student" wrote in message ... In the worksheet: =SUM(Sheet1!A1:Sheet1!A13) works just fine, giving the sum of cells. In VBA: Dim i As Variant i = Application.SUM(Sheet1!A1:Sheet1!A13) just give a compile error. Why? -- Gary's Student |