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

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Testing for formula or value (constant)

Try this structure...

If Range("A1").HasFormula Then
MsgBox "A1 has a formula"
ElseIf Range("A1").Value < "" Then
MsgBox "A1 has a constant value in it"
Else
MsgBox "A1 is empty"
End If

--
Rick (MVP - Excel)


"JH" wrote in message
...
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
Formula vs. Constant rk0909 Excel Discussion (Misc queries) 24 January 14th 10 06:34 PM
Testing for formula or value (constant) Mike Excel Programming 0 December 1st 09 04:50 PM
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
Constant in Formula Sige Excel Programming 27 September 28th 05 08:21 AM


All times are GMT +1. The time now is 10:47 PM.

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"