Search code examples
excelexcel-2007vba

How can I find out if a cell in Excel contains a number/text or a formula?


What I like to do is conditionally format cells depending on whether the cell contains a formula (something starting with "=") or not.

Is this feasible in Excel 2007?


Solution

  • You can use:

    If (cell.HasFormula) then ..
    

    To look for formulas.

    (This will avoid the problem of literal string field starting with an "=")