View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_85_] Leith Ross[_85_] is offline
external usenet poster
 
Posts: 1
Default Sum of Len(string) for an entire row


Hello Durex,

I played it safe answering your first question. Sometimes people say VB
and worksheet formula and vice versa. So, here's what to do.


Code:
--------------------
Public Function AddRow(ByVal Row_Range As String) As Variant

Dim Total
Dim X

For Each X In ActiveSheet.Range(Row_Range)
Total = Total + Val(X.Value)
Next X

AddRow = Total

End Function

--------------------


TO USE IT:

Dim X

X = AddRow("A1:G1")

X = Sum of the row. At least the sum of any valid numbers in the row.


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=478407