Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Cell type determination in VBA 1

Status
Not open for further replies.

popper

Programmer
Dec 19, 2002
103
AU
Hi there,

Does anyone know a way of telling in VBA code what type of data a given spreadsheet cell holds where the type would be either

numeric (like 36)
text (like "Saturday")
or
formula (like "=A1*2")

Would there by a property of the cell which would reveal this or do we have to write code to examine each character of the cell contents until we could establish this?

Any help would be appreciated.

Thank you
 

Depending on exactly what you may have, take a look at the HasFormula property of the Cell before perhaps checking TypeName(CellRef.Value) for "String" or "Double" or "Boolean" (or "Empty" if you don't check for that separately)

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top