how to convert a formula into text in order to display the formula

C

Claudio Hartzstein

I want to display the formula and the result in the same worksheet so that
people can know what calculation has been used to obtain the given result.
 
J

Jim May

As Ardus suggested:
Here are 2 macros (Put In Standard Module)
1) to Add All Existing Formulas to a CommentBox
2) to Remove All Comments <<Watch Out This removes ALL
Comments (not just ones created by 1) above..
HTH
Jim May

Sub ShowFormulasInComments()
Dim cell As Range
Dim sh As Worksheet
Dim i As Long
Set sh = ActiveSheet
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula Then
cell.AddComment.Text Text:=cell.Formula
End If
Next cell
End Sub
Sub RemoveFormulasInComments()
ActiveSheet.UsedRange.ClearComments
End Sub
 
Top