Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to sum the values in a range and have the following code:
Dim Total As Integer For Each c In Worksheets("Error Codes").Range("T10:T45").Cells Total = Total + c.Value Next ErrorCount = Total I added a watch to c and the looping works or at least appears to yet it wont extract a value despite the column t10 onwards having values. Regards in advance for assistance. Peter |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Peter
I don't know if I understand you correct ? Why do you use a loop You can use the sum function in VBA like this Sub test() MsgBox Application.WorksheetFunction.Sum(Worksheets("Erro r Codes") _ ..Range("T10:T45")) End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Peter Bailey" wrote in message ... I want to sum the values in a range and have the following code: Dim Total As Integer For Each c In Worksheets("Error Codes").Range("T10:T45").Cells Total = Total + c.Value Next ErrorCount = Total I added a watch to c and the looping works or at least appears to yet it wont extract a value despite the column t10 onwards having values. Regards in advance for assistance. Peter |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent, I find it harder in access as the envoronment does not return the
methods when I for example go range. (dot) like it does in access vba environment. thank you that is just what I needed. :) "Ron de Bruin" wrote in message ... Hi Peter I don't know if I understand you correct ? Why do you use a loop You can use the sum function in VBA like this Sub test() MsgBox Application.WorksheetFunction.Sum(Worksheets("Erro r Codes") _ .Range("T10:T45")) End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Peter Bailey" wrote in message ... I want to sum the values in a range and have the following code: Dim Total As Integer For Each c In Worksheets("Error Codes").Range("T10:T45").Cells Total = Total + c.Value Next ErrorCount = Total I added a watch to c and the looping works or at least appears to yet it wont extract a value despite the column t10 onwards having values. Regards in advance for assistance. Peter |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extracting First Name | New Users to Excel | |||
extracting last name | Excel Worksheet Functions | |||
extracting dd from dd/mm/yy | Excel Worksheet Functions | |||
extracting IF | Excel Programming | |||
extracting IF | Excel Programming |