Excel

Show Formula as Text

Ease of Use

Intermediate

Version tested with

2002 

Submitted by:

Zack Barresse

Description:

This is a User-Defined Function (UDF) that will show the formula of a cell as text. If no formula, it will show the cell value. 

Discussion:

Providing a summary of your spreadsheet and want to show your formula(s) as text? This UDF will do just that. So if you type in A1 "=1+1" you will see "2" in that cell. With this if you type "=FTEXT(A1)" you will see "=1+1" 

Code:

instructions for use

			

Function FTEXT(f As Range) If f.HasFormula Then FTEXT = f.Formula Else: FTEXT = f End If End Function

How to use:

  1. Copy code.
  2. Open workbook to copy code to.
  3. In Excel, press Alt + F11 to open the VIsual Basic Editor (VBE).
  4. Click the Insert menu.
  5. Click Module.
  6. Paste code in right window.
  7. Press Alt + Q to close the VBE.
 

Test the code:

  1. In a blank cell type =FTEXT(A1), change A1 to desired cell.
 

Sample File:

FTEXT.zip 5.34KB 

Approved by mdmackillop


This entry has been viewed 208 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express