Need a programme that calculates sum every time I put in one cell a number. For example, in cell A1 to put the number: 1, 1200, 0.50 and in cell B1 to calculate the sum of ( 1,1200,0.50)
If anyone could help me,
Thank you in advance.
As long as there are 3 numbers and configuration same
first number comma space second number comma space third number
then the following macro will get you the result in B1
A formula can be built up but for me it will be complicated.
The macro is:
Dim j, j1, k, k1, m, m1, n
j = InStr(Range("a1").Value, ",")
j1 = Left(Range("A1").Value, j - 1)
k = InStr(j + 1, Range("A1").Value, ",")
k1 = Mid(Range("A1").Value, j + 2, k - 4)
m1 = Right(Range("A1").Value, Len(Range("A1").Value) - k)
n = WorksheetFunction.Sum(j1, k1, m1)
Range("B1") = n
Thanks to venkat1926
for this tip on the forum.
Published by aakai1056
Latest update on January 28, 2010 at 11:59 AM by aakai1056.