How in to parse constants in formula to cells
Ron, if you would, please indicate exactly the changes that you
suggest. I really did try many different settings but to no avail.
What I do not like about (me) doing a work-around, is that I lose the
chance to learn a new concept or approach.
I tried -?\b64596792\b -?\b-64596792\b \b-64596792\b
b-64596792\b etc.
Now I realize that I may have avoided your earlier point because I did
not understand what it was doing and, at that time, I had an immediate
project to complete and I thought I'll learn new concepts later. I
just could not take a chance that numerous others' worksheets
(formulas) would be changed incorrectly. Your comments we
If that doesn't work, and you must test for ONLY operators, then
change two lines:
Pattern = "([=-+/*])" & NumToReplace & "\b"
(Should I have tried "-" & NumToReplace & "\b")
FormulaText = objRegExp.Replace(FormulaText, "$1" & ReplWith)"
(What does the "$1" represent? - is it any of "([=-+/*])"
Thanks, Dennis
Ron Rosenfeld wrote:
On 1 Dec 2006 19:25:00 -0800, "Dennis" wrote:
Ron,
In the example, the minus sign is not transferred.
In the interim, I use an input box and flip the sign to positive.
Then, the following:
ReplaceWith = Replace(FormulaText, "=", "```")
If (objRegExp.Test(FormulaText) = True) Then
TempText = objRegExp.Replace(FormulaText, ReplaceWith)
TempText = IIf(NumbToReplace < 0, Replace(TempText, "-```", "+"), _
Replace(TempText, "```", "+"))
ActiveCell.formula = TempText
End if
Thanks for you knowledge and time.
Dennis
Well, you can retain the "-" by merely changing the parameters in the Pattern
and RegExp.Replace functions also.
But, whatever works for you.
--ron
|