Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determining cellcontents

How do I, programmatically, determine whether a specific
cell contains a formula or a number?

I have written something like this

....
CellContents = ActiveCell.Formula
MsgBox CellContents
....

This shows the cellcontents in the messagebox, but I
cannot find out how to have the macro to determine whether
or not this is a formula. In this case, I want to delete
the whole row if the cell content is a formula.

Hope someone could help me with this problem.

Stefan J


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Determining cellcontents

Stefan,

Use the HasFormula property. This will return True if the cell
contains a formula, or False if the cell does not contain a
formula. E.g.,

If ActiveCell.HasFormula Then
MsgBox "Formula"
Else
MsgBox "Not A Formula"
End If

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Stefan J" wrote in message
...
How do I, programmatically, determine whether a specific
cell contains a formula or a number?

I have written something like this

...
CellContents = ActiveCell.Formula
MsgBox CellContents
...

This shows the cellcontents in the messagebox, but I
cannot find out how to have the macro to determine whether
or not this is a formula. In this case, I want to delete
the whole row if the cell content is a formula.

Hope someone could help me with this problem.

Stefan J




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
Determining the Age of a Person mpenkala Excel Worksheet Functions 5 December 21st 06 02:48 PM
Determining the current row and col k483 Excel Discussion (Misc queries) 2 November 25th 05 05:50 PM
need help with determining a formula Cal Excel Worksheet Functions 2 November 11th 05 01:49 PM
birthdays - determining when due mcraig Excel Discussion (Misc queries) 4 August 7th 05 03:50 PM
Determining a Date Mark Excel Discussion (Misc queries) 1 July 1st 05 03:13 PM


All times are GMT +1. The time now is 05:48 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"