Microsoft Office Tutorials and References
In Depth Information
Try It
And that’s all there is to it. Now if you go back to the Insert Function dialog and select the
ExtractNumbers UDF, a description appears as shown in Figure 16-7, providing the users with a
useful tip for how to enter the UDF.
figurE 16-7
Try iT
In this lesson you practice creating a User Defined Function that tests whether a particular cell
contains a comment. If so, it returns the text of that comment; if not, it returns “No comment.”
lesson requirements
To get the sample database files, you can download Lesson 16 from the book’s website at .
Create a UDF to examine another cell’s comment.
From your keyboard press Alt+F11 to get into the VBE, and from the menu bar click Insert
Enter the function name, declare an argument variable for a Range type because a cell will be
evaluated, and declare the Function type as String because the UDF will return text of some
kind. For example:
Function GetComment(rng As Range) As String
Declare a String type variable to handle either the comment text, or the “No comment”
statement. For example:
Dim strText As String
Search JabSto ::

Custom Search