Is formula ?

italkid
03-28-2003, 04:55 AM
Maybe this is a stupid question...
How to know if a single cell contents is or is not a formula ?

i can figure it out for a range bigger than one cell with :

Set celtel = Selection.SpecialCells(xlCellTypeFormulas)

If celtel Is Nothing Then
MsgBox "No formulas found. "

I don't get this working for one single cell.

If somebody would know the answer...

XL-Dennis
03-28-2003, 05:17 AM
Hi,

Following shows one way to handle it:


Option Explicit

Sub test()
Dim celtel

On Error GoTo Errorhandling

Set celtel = Selection.SpecialCells(xlCellTypeFormulas)

Exit Sub

Errorhandling:
MsgBox "No formulas found."
End Sub

italkid
03-28-2003, 05:35 AM
Sorry XL-Dennis,

Maybe you misunderstand me or i diden't explaind it well

The code i posted (actually the same as yours) will do the "is or is not formula" test only on a range bigger than 1 cell.

This way it don't work as i want and what i want is to find out that one cell (the active one) has got or not a formula.

I want to the test only 1 cell.

italkid
03-28-2003, 06:45 AM
Found the solution !


If ActiveCell.HasFormula Then
MsgBox "formule"
Else
MsgBox "geen formule"
End If


Thanks anyway,

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum