Microsoft Knowledge Base |
|
XL: Reference Edit Box Returns Incorrect Reference |
|
|
Last reviewed: September 13, 1996
Article ID: Q117232 |
|
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you use a reference edit box (item 10) in a user- defined dialog box to return a reference to a range on a worksheet, and if the returned worksheet name contains spaces (for example, if the worksheet is named "My Worksheet"), the returned reference is incorrect.
CAUSEThis behavior occurs when you use a reference edit box to reference a range on a worksheet in the same workbook that contains the dialog definition table that is used to create the reference edit box. When the sheet name contains a space, the reference returned by the reference edit box does not include the workbook name inside the apostrophe characters the way it should. For example, when you run a macro that displays a reference edit box, and you select the range A1:C3 on the worksheet "Two Words" in the workbook BOOK1.XLS (the same workbook that contains the macro), the range appears in the reference edit box as follows:
'Two Words'!$A$1:$C$3However, the reference that is returned by the reference edit box is as follows:
[BOOK1.XLS]'Two Words'!R1C:R3C3Note that the book name is outside the apostrophe characters, creating an incorrect reference to the range on the worksheet.
WORKAROUNDTo avoid this problem, use a dialog sheet to create the reference edit box instead of a dialog box definition table on a macro sheet. To create a reference edit box in a dialog box using a dialog sheet, do the following:
'Two Words'$A$1:$C$3 STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
REFERENCES"Visual Basic User's Guide," version 5.0, pages 236-237
|
|
KBCategory: kbusage
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |