Knowledge Base |

# Static and dynamic default buttons in dialog boxes in Excel

Article ID: 105552

Article Last Modified on 11/17/2005

APPLIES TO

- Microsoft Excel 95 Standard Edition
- Microsoft Excel 5.0 Standard Edition
- Microsoft Excel 5.0c
- Microsoft Excel 5.0 Standard Edition
- Microsoft Excel 5.0 for Macintosh

This article was previously published under Q105552

## SUMMARY

In Microsoft Excel custom dialog boxes, there are two types of default buttons: static and dynamic.

## MORE INFORMATION

In custom dialog boxes in Microsoft Excel, you can set one button in a dialog box as the Default button. To set a button as the Default button:

1. Select the button that you want to be the Default button.
2. From the Format menu, choose Object.
3. Select the Control tab.
4. Select the Default check box.
5. Choose OK to accept the change.

The Default button is also called the static default button. Pressing the ENTER key will activate the Default button only if no other button has the focus. Other buttons in the dialog box are called dynamic default buttons. Pressing the ENTER key will activate a dynamic default button only if that button currently has the focus.
If you have a dialog box that contains multiple controls, such as those listed here, pressing ENTER when a control has the focus will either activate the Default button or it will activate another button.

        If this control has the Focus   Pressing ENTER Activates this control
        ---------------------------------------------------------------------

        DefaultButton                   DefaultButton
        Button2                         Button2
        Button3                         Button3
        EditBox1                        DefaultButton
        CheckBox1                       DefaultButton
        CheckBox2                       DefaultButton
        ListBox1                        DefaultButton
        DropDown1                       DefaultButton

In Microsoft Excel for Windows, Windows 95, and Windows NT, if you want a specific control to have the focus when you display a dialog box, you can set the Tab Order of the dialog box so that the control is at the top of the Tab Order. To access the Tab Order dialog box:

1. From the Tools menu, choose Tab Order.
2. Select the desired control from the Tab Order list.
3. Choose the Move Up or Move Down button.
4. Choose the OK button.

## REFERENCES

"Visual Basic User's Guide," version 5.0, page 228-229

Additional query words: 5.00a 5.00c XL

Keywords: kbinfo kbpubtypekc KB105552