Need macro to parse function into longhand

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

Has anyone parsed a function to change divides into horizontal bars to
make it look more readable? ie make it look more like MathCAD
functions, so simple errors like a misplaced bracket would be more
obvious.

I was thinking you could redraw the function in some free cells, but
it could be text only, as it is only a visual aid to document the
embedded equation.

Steve
 
Steve,

Something like this ?...
'------------------------------------
'Replaces left and right parenthesis with brackets.
'In this example the formula in Cell C6 is displayed
'in Cell E6 with the replaced characters.
'Note:
'1. In the second substitution, '"strFormula" is replaced with "strAnswer".
'2. "'" is a single quote mark enclosed in " "

Sub MakeItUnderstandable()
Dim strAnswer As String
Dim strFormula As String

strFormula = Range("C6").Formula
strAnswer = "'" & Application.Substitute(strFormula, "(", "[")
strAnswer = Application.Substitute(strAnswer, ")", "]")
Range("E6").Value = strAnswer
End Sub
'---------------------------------------

Regards,
Jim Cone
San Francisco, USA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top