Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Arg's to Application.worksheetfunction.sum()

Status
Not open for further replies.

OscarAlberto

Programmer
Dec 4, 2002
15
CR
Is it at all possible to programatically add arguments to the application.worksheetfunction.sum every time my codes cycles through a Do-Until-Loop????

Thanks in advance.
 
Hi OscarAlberto,

It seems like a slightly odd way to do things but, yes, it can be done, at least indirectly, by, for example, adding areas to the range being summed.

Code:
Dim tjRange As Range
Dim x As Integer

Set tjRange = Sheets!Sheet1.Range("a1")

For x = 2 To 7
    Set tjRange = Union(tjRange, Cells(x, x))
    MsgBox WorksheetFunction.Sum(tjRange)
Next

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top