Microsoft KB Archive/115401

= Microsoft Knowledge Base =

XL: Linked List Box Returns Incorrect Index Value
Last reviewed: September 13, 1996

Article ID: Q115401

The information in this article applies to:


 * Microsoft Excel for Windows, versions 5.0, 5.0c
 * Microsoft Excel for Windows 95, versions 7.0, 7.0a
 * Microsoft Excel for the Macintosh, versions 5.0, 5.0a

SYMPTOMS
In the versions of Microsoft Excel listed above, when you use the Microsoft Excel 4.0 macro language to create a custom dialog box, the following two types of dialog box controls will return incorrect index values:

 A linked list box (dialog box item 16), if the same text string is in the list more than once. -or- A drop-down combination edit/list box (dialog box item 22)

WORKAROUND
To work around this problem, change the linked list box item number (cell B4 below) from 16 to 15 (that is, change it to a standard list box). If you are using a drop-down combination edit/list box, change the item number 22 to a 21 (to a standard drop-down list box).

Steps to Reproduce Behavior
 From the Insert menu, choose Macro, and then choose MS Excel 4.0 Macro.  In the macro sheet, type the following macro: A1: =DIALOG.BOX(B2:H6) A2: =RETURN   In the range B2:G6 of the macro sheet, type the following dialog box information: B2:    C2:      D2:      E2: 360  F2: 312   G2: Select Employee B3: 6  C3: 7    D3: 11   E3: 171  F3:       G3: B4: 16 C4: 7    D4: 43   E4: 171  F4: 224   G4: R10C7:R18C7 B5: 1  C5: 105  D5: 277  E5: 64   F5:       G5: OK      B6: 2   C6: 187  D6: 277  E6: 64   G5:       G6: Cancel   In the range G10:G18, type the list for the list box: G10: Sue Brown G11: Dave Jones G12: John Smith G13: Sue Brown G14: Al Davis G15: Steve Hall G16: Terry Carter G17: Sue Brown G18: Nancy Blum  Select cell A1.</li> From the Tools menu, choose Macro, and choose Run.</li> Choose the first "Sue Brown" in the list, and choose OK.</li></ol>

The index number returned to H4 is 8 instead of 1.

NOTE: In Microsoft Excel 4.0, you receive the correct result of 1.