Microsoft Office Tutorials and References
In Depth Information
Determining a Cell’s Data Type
Case UpperLeft.NumberFormat = “@”
Case IsEmpty(UpperLeft.Value)
CELLTYPE = “Blank”
Case WorksheetFunction.IsText(UpperLeft)
Case WorksheetFunction.IsLogical(UpperLeft.Value)
CELLTYPE = “Logical”
Case WorksheetFunction.IsErr(UpperLeft.Value)
CELLTYPE = “Error”
Case IsDate(UpperLeft.Value)
Case InStr(1, UpperLeft.Text, “:”) <> 0
Case IsNumeric(UpperLeft.Value)
CELLTYPE = “Value”
End Select
End Function
Figure 25-1 shows the CELLTYPE function in use. Column B contains formulas that use the
CELLTYPE function with an argument from column A. For example, cell B1 contains the following
Figure 25-1: The CELLTYPE function returns a string that describes the contents of a cell.
The workbook celltype function.xlsm that demonstrates the CELLTYPE function
is available on the companion CD-ROM.
Search JabSto ::

Custom Search