Return to VBA Code Examples

VBA Function to Show Cell Formula


The following UDF will return the formulae for a given cell reference:

VBA Function to Show Cell Formula

Function Show_Cell_Formulae(Cell As Range) As String
    Show_Cell_Formulae = "Cell " & Cell.Address & " has the formulae: " & Cell.Formula & " '"
End Function

So if we have:
139 show cell formulae

Where the cell B7 has the formulae : ‘=MAX(B5:G5) then we can type in another cell:
B9 = Show_Cell_Formulae(b7)

139 show cell formulae part 2

And we get a text string with the cell reference and the formulae contained within it.

To download the .XLSM file for this article, click here

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Learn More!


<<Return to VBA Examples

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples