XL: No Error Message with Incorrect Range Reference SyntaxLast reviewed: September 2, 1997Article ID: Q151097 |
The information in this article applies to:
SYMPTOMSAlthough inserting an exclamation point before the left parenthesis of the Range method is incorrect syntax in Visual Basic for Applications, it may not produce an error message.
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.
MORE INFORMATIONMicrosoft provides examples of Visual Basic for Applications procedures 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. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400. You receive the error message, "Type-declaration character does not match declared data type," when setting a range variable with the syntax used in the following sample macro:
Option Explicit Sub DisplaysError() Dim ws as Worksheet Dim r as Range Set ws = Sheets!Sheet1 Set r = ws.range!("A1:A6") End SubThe following syntax does not produce an error message:
Option Explicit Sub DoesNotDisplayError() Dim r as Range Set r = Sheets!Sheet1.Range!("A1:A6") End SubUsing the exclamation point after Range when setting the range variable off of a worksheet variable properly produces an error message. Using the exclamation point when the range variable is set off of a worksheet reference does not produce an error message.
REFERENCESFor more information about the range method in Microsoft Excel 5.0, search for "range method" and then "range method" using the Microsoft Excel Visual Basic Reference Help file. For more information about the range method in Microsoft Excel 7.0, search for "range method" and then "range method" using the Microsoft Excel for Windows 95 Help Index.
|
Additional query words: 5.00 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |