Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function FormulaAsText(Cell As Range, Optional R1C1_METHOD As Boolean) As String
- 'PGCodeRider
- 'Note in Excel 2013 and later, MS implemented an almost identical formula for this =FORMULATEXT(
- If Cell.Cells.Count > 1 Then
- 'not necassary but Formula will #VALUE without this check
- FormulaAsText = "Must Select Single Cell"
- ElseIf R1C1_METHOD = False Then
- FormulaAsText = Cell.Formula
- Else
- FormulaAsText = Cell.FormulaR1C1
- End If
- 'Note using R1C1 Can be useful if you're looking at cells and want to see a functional difference accross rows in columns.
- 'Exammple is if regular cell formula method is used for cells in row 3 referenceing one cell above, they would appear as =A2 =B2 = C2... etc.
- 'However with R1C1 You would consistently get a formula of =R[-1]C for all cells.
- End Function
Add Comment
Please, Sign In to add comment