LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 690
Default Question On Excel Formulas

Hi. Don't know if you would be interested in this idea:
If I select your equation, and run this macro (via button for me), then I
display a message like the one below.
This only works for simple equations like yours. Doesn't work well for more
complicated equations.
I personally like to make them cell notes. Maybe this will give you some
ideas for your own:

Sub Equation_Values()
Dim v As Variant
Dim itm As Variant
Dim Fx As String
Dim s As String

Fx = ActiveCell.Formula
s = Fx & vbLf

On Error Resume Next
Set v = ActiveCell.Precedents
If Err.Number 0 Then Exit Sub

For Each itm In v
Fx = Replace(Fx, itm.Address(True, True), itm.Value)
Fx = Replace(Fx, itm.Address(True, False), itm.Value)
Fx = Replace(Fx, itm.Address(False, True), itm.Value)
Fx = Replace(Fx, itm.Address(False, False), itm.Value)
Next itm
s = s & vbLf & Fx & vbLf

For Each itm In v
s = s & vbLf & itm.Address(False, False) & ": " & itm.Value
Next itm

'// Usa a Message Box
' MsgBox s

'// Or make it a Comment
Err.Clear
ActiveCell.AddComment s
If Err.Number 0 Then ActiveCell.Comment.Text s
ActiveCell.Comment.Shape.TextFrame.AutoSize = True
End Sub


Displays:
= = = = = = =
=A1+B1+C1/D1

=5+2+3/4

A1: 5
B1: 2
C1: 3
D1: 4
= = = = = = =



--
Dana DeLouis
Win XP & Office 2003


"David Smith" wrote in message
...
Hello,

Is there a way (addin utilities or otherwise) to cause the formula in a
cell to display the values for the component references making up the
formula?

-i.e =A1 *(B2+C4)/D2

would display based on the cell reference values as:

=5*(4+6)/8

Thanks for your help,

David S





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic question about what formulas look at. Randy Excel Worksheet Functions 3 March 30th 07 09:05 PM
Question On Excel Formulas David Smith Excel Worksheet Functions 14 November 21st 05 06:10 PM
question on formulas D Excel Programming 1 August 18th 05 08:18 PM
Question on formulas Trackkid12 Excel Programming 1 May 13th 04 04:46 PM
Question about Formulas Cincy Man Excel Programming 3 April 9th 04 09:49 PM


All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"