Page 273 - Excel Data Analysis
P. 273

15 537547 AppC.qxd  3/4/03  11:56 AM  Page 259






                                                             VBA AND EXCEL EVENTS QUICK REFERENCE C



                     VBA STATEMENTS QUICK REFERENCE (CONTINUED)


                        Variable Declaration (Continued)
                         STATEMENT                                             DESCRIPTION
                         Public [WithEvents] varname[([subscripts])] [As [New] type]  Declares variables and procedures to have scope
                                                                               within the entire project.
                         ReDim [Preserve] varname(subscripts) [As type]        Changes the dimensions of a dynamic array.
                         [Private | Public] Type varname                       Defines a custom data type.
                         elementname [([subscripts])] As type
                         [elementname [([subscripts])] As type]
                         ...
                         End Type



                     VBA FUNCTION QUICK REFERENCE


                        Legend:
                        Plain courier text = required          Italics = user-defined    | = or
                        [] = optional                          ...= list of items

                        Array Functions
                         FUNCTION                    DESCRIPTION                                       RETURNS
                         Array(arglist)              Creates a variant array containing the specified elements.  Variant
                         LBound(arrayname[, dimension])  Returns the smallest subscript for the specified array.  Long
                         UBound(arrayname[, dimension])  Returns the largest subscript for the specified array.  Long
                        Data Type Conversion Functions

                         FUNCTION                    DESCRIPTION                                       RETURNS
                         Asc(string)                 Returns the character code of the first letter in a string.  Integer
                         CBool(expression)           Converts an expression to Boolean data type (True or False). Boolean
                         CByte(expression)           Converts an expression to Byte data type.         Byte
                         CCur(expression)            Converts an expression to Currency data type.     Currency
                         CDate(expression)           Converts an expression to a Date data type.       Date
                         CDbl(expression)            Converts an expression to Double data type.       Double
                         CDec(expression)            Converts an expression to a decimal value.        Variant
                                                                                                       (Decimal)
                         Chr(charactercode)          Converts the character code to the corresponding   Variant
                                                     character. Chr(9) returns a tab, Chr(34)          (String)
                                                     returns quotation marks, and so on.
                         CInt(expression)            Converts an expression to an Integer data type,   Integer
                                                     rounding any fractional parts.


                                                                                                                     259
   268   269   270   271   272   273   274   275   276   277   278