![]() |
trying to use sum with range & offest
The following gives me a Compile Error:Invalid Qualifier (highlights the Sum
word) For x = 0 To 9 Range("B4").Activate y = WorksheetFunction.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next Whats wrong? |
trying to use sum with range & offest
Give this a try...
For x = 0 To 9 Range("B4").Activate y = Application.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next or For x = 0 To 9 Range("B4").Activate y = Application.WorksheetFunction.Sum(Range(ActiveCell .Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next -- HTH... Jim Thomlinson "Scott" wrote: The following gives me a Compile Error:Invalid Qualifier (highlights the Sum word) For x = 0 To 9 Range("B4").Activate y = WorksheetFunction.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next Whats wrong? |
trying to use sum with range & offest
The second recommendation gave me the same original compile error. The first
got past the compile but gives me a runtime error '424' object required. -------------------------------------------------------------------- "Jim Thomlinson" wrote: Give this a try... For x = 0 To 9 Range("B4").Activate y = Application.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next or For x = 0 To 9 Range("B4").Activate y = Application.WorksheetFunction.Sum(Range(ActiveCell .Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next -- HTH... Jim Thomlinson "Scott" wrote: The following gives me a Compile Error:Invalid Qualifier (highlights the Sum word) For x = 0 To 9 Range("B4").Activate y = WorksheetFunction.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next Whats wrong? |
trying to use sum with range & offest
Get rid of the .Value at the end of the statement...
For x = 0 To 9 Range("B4").Activate y = WorksheetFunction.Sum(Range(ActiveCell.Offset(x, 0), _ ActiveCell.Offset(x, 23))) Next -- HTH... Jim Thomlinson "Scott" wrote: The second recommendation gave me the same original compile error. The first got past the compile but gives me a runtime error '424' object required. -------------------------------------------------------------------- "Jim Thomlinson" wrote: Give this a try... For x = 0 To 9 Range("B4").Activate y = Application.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next or For x = 0 To 9 Range("B4").Activate y = Application.WorksheetFunction.Sum(Range(ActiveCell .Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next -- HTH... Jim Thomlinson "Scott" wrote: The following gives me a Compile Error:Invalid Qualifier (highlights the Sum word) For x = 0 To 9 Range("B4").Activate y = WorksheetFunction.Sum(Range(ActiveCell.Offset(x, 0), ActiveCell.Offset(x, 23))).Value Next Whats wrong? |
All times are GMT +1. The time now is 11:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com