View Single Post
  #4  
Old 07-06-2005, 01:27 PM
dominicb's Avatar
dominicb dominicb is offline
Forum Moderator
 
Join Date: 25 Jan 2005
Location: Lancashire, England
MS Office Version:MS Office 2000, 2003 & 2007
Posts: 3,310
dominicb has an addiction to Excel
Smile

Good evening the-charles

This function will add up all the numbers in a cell, provided it is applied to a numeric cell. Once pasted into your VBE use it like you would a formula, thus:

=Adder(A1) will perform the operation on cell A1.

Function Adder(InThis)
d = 0
a = Len(InThis)
For b = 1 To a
c = Mid(InThis, b, 1)
d = d + c
Next b
Adder = d
End Function

HTH

DominicB
Reply With Quote