View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Vic Eldridge Vic Eldridge is offline
external usenet poster
 
Posts: 50
Default help with looping range and extracting value

Your code works fine here, but it's an inefficient way of summing a
range.
Try something like this,
errorcount = Application.WorksheetFunction.Sum(Worksheets("Erro r
Codes").Range("T10:T45"))


Regards,
Vic Eldridge


Pb21 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