ID: Q119084
The information in this article applies to:
In Microsoft Excel, when you assign values to the List property of the ListBoxes object, the link for that list box is cleared. If you want to remove the link but leave the values that resulted from the link, you can reassign the List property of the list box to the values from the worksheet, and the values will remain even though the link is broken.
This article contains a sample Microsoft Visual Basic for Applications macro that breaks the link between a list box (or a drop-down list box) on a dialog sheet and a worksheet range but leaves the values from that range in the box.
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/refguide/
1. In a new workbook, create a dialog sheet, and name it "Dialog Example"
(without the quotation marks).
2. In the dialog sheet, create a list box, and name it "ListBox" (without
the quotation marks).
3. Select the list box, and on the Format menu, click Object. In the
Input Range box, enter the worksheet range that contains the list that
you want to appear in the list box.
1. On the Insert menu, click Macro, and then click Module.
2. On the module sheet, enter the following macro code:
Sub break_link()
Dialogsheets(1).ListBoxes("ListBox").List = _
Dialogsheets(1).ListBoxes("ListBox").List
End sub
NOTE: If you are using a drop-down box, substitute the DropDowns object
for the ListBoxes object in the code above.
3. On the Tools menu, click Macro, select the break_link macro, and
click Run.
When you select the list box on the dialog sheet and click Object on the
Format menu, note that the Input Range box is empty but the list box still
contains the values from the worksheet range.
In Microsoft Excel, you can place values in a list box or in a drop-down box by linking the box to a range on a worksheet To do this, select the box, and click Object on the Format menu. Then, enter the desired range in the Input Range box.
Additional query words: 5.00 5.00c 7.00
Keywords : kbcode kbprg PgmHowto PgmCtrlsStd
Version : WINDOWS:5.0,7.0; MACITNOSH:5.0
Platform : MACINTOSH WINDOWS
Issue type : kbhowto
Last Reviewed: May 17, 1999