Fair enough complaint! :) I posted the function code at the end of the
"Many to One?" thread, but it is
Public Function SumSplitData(strText)
Dim re As Object
Dim ptrn, Tokens
Dim i As Integer
Dim SumSplitData As Double
Set re = CreateObject("vbscript.regexp")
' allow separators of semicolon, comma, blank, \n
ptrn = "[^;, " + Chr(10) + "]+"
re.Pattern = ptrn
re.IgnoreCase = False
re.Global = True
Set Tokens = re.Execute(strText)
SumSplitData = 0
For i = 0 To Tokens.Count - 1
SumSplitData = SumSplitData + CDbl(Tokens(i))
Next
End Function
If enter any values into A1 and A2, as (say)
A1: 600, <Alt-Enter> 236.54
A2: 1030.01, , <Alt-Enter> 200
A3: =SUM(A1:A2)
and B1, B2 contain =SumSplitData(A1), =SumSplitData(A2), then when
programatically via COM write "=SUM(B1:B2)" into B3, the formula in B3
is still text in the Excel spreadsheet while similarly haven written A3,
since column A is numeric instead and B is text, A3 is interpreted as
the formula and shows the number while B3 just shows the text.
As noted, can make any change like adding/deleting blank at beginning of
the formula and resave manually and then Excel converts the cell.
I've got another refinement to add so it'll be just a bit before can
test your idea, figured would post the added info now ...
--