Leading the way in Microsoft Office Development
 Home|Excel|Word|PowerPoint|Consultancy|Feedback|Contact 
 Microsoft Excel > Functions User Defined > FORMULAGET< Previous | Next > 

 

FORMULAGET(rgeCell [,bCellAddressPrefix])

 
 

Returns the formula from a particular cell.

 

 
rgeCellThe cell you want to check.
bCellAddressPrefixWhether you want the formula prefixed with the cell address.
 

 

REMARKS

 
 
  • ??

     

     
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    Option Explicit

    Public Function FORMULAGET(ByVal rgeCell As Range, _
                      Optional ByVal bCellAddressPrefix As Boolean = False) As String
                      
       Call Application.Volatile(True)
       
       If VarType(rgeCell) = 8 And Not rgeCell.HasFormula Then
          FORMULAGET = "'" & rgeCell.Formula
       Else
          FORMULAGET = rgeCell.Formula
       End If
       If rgeCell.HasArray Then
          FORMULAGET = "{" & rgeCell.Formula & "}"
       End If
       
       If bCellAddressPrefix = True Then
          FORMULAGET = rgeCell.Address(0, 0) & ": " & FORMULAGET
       End If
    End Function
       

     

    Example

     
       

     Copyright © 2004-2007 Better Solutions Limited. All Rights Reserved.< Previous | Top | Next >