11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

676<br />

Part VI: Developing Custom Worksheet Functions<br />

Case UpperLeft.NumberFormat = “@”<br />

CELLTYPE = “Text”<br />

Case IsEmpty(UpperLeft.Value)<br />

CELLTYPE = “Blank”<br />

Case WorksheetFunction.IsText(UpperLeft)<br />

CELLTYPE = “Text”<br />

Case WorksheetFunction.IsLogical(UpperLeft.Value)<br />

CELLTYPE = “Logical”<br />

Case WorksheetFunction.IsErr(UpperLeft.Value)<br />

CELLTYPE = “Error”<br />

Case IsDate(UpperLeft.Value)<br />

CELLTYPE = “Date”<br />

Case InStr(1, UpperLeft.Text, “:”) 0<br />

CELLTYPE = “Time”<br />

Case IsNumeric(UpperLeft.Value)<br />

CELLTYPE = “Value”<br />

End Select<br />

End Function<br />

Figure 25-1 shows the CELLTYPE function in use. Column B contains formulas that use the<br />

CELLTYPE function with an argument from column A. For example, cell B1 contains the following<br />

formula:<br />

=CELLTYPE(A1)<br />

Figure 25-1: The CELLTYPE function returns a string that describes the contents of a cell.<br />

The workbook celltype function.xlsm that demonstrates the CELLTYPE function<br />

is available on the companion CD-ROM.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!