MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VBA GUYS / GALS NEEDED


Posted by Tim on June 18, 2001 5:31 AM

Hi

Im trying to get it so that when i press a cell it displays the values that made up the figure in that cell.

e.g.

A1 = "10"
B1 = "15"
C1 = "=A1+B1"

WHEN C1 IS CLICKED IT WILL POPUP 10 + 15

Thanxs

Tim


Posted by Sean on June 18, 2001 6:00 AM

Re: Part way there...But going off lunch now...

Posted by Sean on June 18, 2001 6:06 AM

Part way there...but going off lunch now

===========
I must remember to stop pressing the enter button before I get into the bottom box!!!

I can get you a list of all the Dependent Cells and their values but the operator is going to be a bit more tricky especially when it is a complex function however, how does this work...

------
Sub Showvals()
rng = ActiveCell.Address
msg = ""
For Each p In range(rng).Precedents
c = p.Address
cv = Format(p.Value, "#,##0.0")
msg = msg & c & " : " & cv & Chr$(10)
Next
MsgBox msg
End Sub

====
Add the attached macro to your module and it works by putting up a message box containing the related cell references and their values. I found it works best by adding a command button on the sheet (or menu bar).

Please note It references the active cell at the point the button is pressed.


Hope it helps
Sean