View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default sum a salary column using macro

You almost got it. Just add application. before the sum

lastrow = cells(Rows.Count,3).End(xlUp).Row
totalsum =application.sum(range("e2:e" & lastrow))
--
Don Guillett
SalesAid Software

"tango" wrote in message
om...
dear all, infact i need very simple coding but i still failed
i have this statement to count the total record to sum

lastrow = Range("C" & Rows.Count).End(xlUp).Row

now i just couldn't find a way to sum up salary column

something like this :

i know this is incorrect but i want something like this so can pass
the value to variable totalsum

totalsum = sum(range("e2:e" & lastrow))