Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Testing for formula or value (constant)

try this
Function ISFORMULA(cel As Range) As Boolean
ISFORMULA = cel.HasFormula
End Function
Sub testforformula()
If ISFORMULA(Range("A1")) Then
MsgBox "Has formula"
Else
MsgBox "Has no formula"
End If
End Sub

"JH" wrote:

Can someone please show me how to test whether the cell is a formula or a
constant in VBA?

say in A1, if I entered a formula, '=D4*E1', msgbox will pop up and say it
is formula, and if I entered a value '1000', it pops up and say it is a value.


Thanks!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing the results of a formula for zero JEFF Excel Discussion (Misc queries) 1 April 16th 07 11:06 PM
Testing for existence of a formula Bob Excel Worksheet Functions 5 November 20th 06 09:31 PM
Formula Constant dale1948 Excel Worksheet Functions 2 November 2nd 05 09:44 PM
Constant in Formula Sige Excel Programming 27 September 28th 05 08:21 AM
Constant Value in formula. Nomad Excel Worksheet Functions 1 March 28th 05 08:53 PM


All times are GMT +1. The time now is 09:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"