XL3/XL4: Dynamic Linked List Dialog Boxes
ID: Q103287
|
The information in this article applies to:
-
Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a
-
Microsoft Excel for OS/2, version 3.0
-
Microsoft Excel for the Macintosh, versions 3.0, 4.0
SUMMARY
You can modify the example macro on page 273 of the "User's Guide 2,"
version 4.0; on page 633 of the "User's Guide," version 3.0 for
Windows; or on page 629 of the "User's Guide," version 3.0 for the
Macintosh, so that you can automatically add items to the linked list
if they do not already exist.
In order to successfully modify this macro, you should be familiar
with the following information:
- How to set up, write, define and execute a command macro.
- How to create and use custom dialog boxes.
- The macro functions DEFINE.NAME(), IF(), MATCH(), OFFSET(), and
FORMULA().
The custom dialog box allows you to select an instrument from a list
and displays it in a text box. The items appearing in the list box
come from an area named "Instruments." If you type the name of an
instrument that is not on the list, the following macro adds it to the
end of the existing list and redefines the defined name "Instruments"
to include the new item.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
To modify the example macro, follow these steps:
- Select the range P6:P21. On the Formula menu, click Define Name,
and name the region "Instruments".
- Replace the contents of cell N16 (R6C16:R21C16) with the Name
"Instruments" (without quotation marks).
- Move the macro code in cells N1:N3 to cells H1:H3.
- Delete the "=RETURN()" statement in cell H3. Starting at cell H3,
add the following macro commands:
H3: =IF(H2<>FALSE)
H4: = MATCH(O15,Instruments,0)
H5: = IF(ISNA(H4))
H6: = FORMULA(O15,OFFSET(P6,ROWS(Instruments),0))
H7: = SET.NAME("Instruments",OFFSET(P6,0,0,ROWS(Instruments)+1,1))
H8: = END.IF()
H9: =END.IF()
H10: =RETURN()
Explanation of Above Macro
H3: Check to see if the "Cancel" button was not chosen.
H4: The MATCH statement checks to see if the name is on the list.
H5: Checks to see if MATCH returns #N/A, indicating that the name is
not on the list.
H6: Places the new instrument on the list as the last item.
H7: Redfines the "Instruments" name to include the new item.
H8: Signals the ending of the first if statement.
H9: Signal the ending of the second if statement.
H10: Ends the macro.
REFERENCES
"User's Guide 2", version 4.0, page 277
"User's Guide", version 3.0, page 637
Additional query words:
4.00a XL3 XL4
Keywords : kbcode kbprg
Version : WINDOWS:3.0,4.0,4.0a; OS/2:3.0: MACINTOSH:3.0,4.0
Platform : MACINTOSH OS/2 WINDOWS
Issue type :
|