The information in this article applies to:
SYMPTOMSIn the versions of Microsoft Excel listed at the beginning of this article, the Range.EntireRow method may return an incorrect result if the Range is a nonadjacent selection. For example, if the current Range is the nonadjacent selection $A$1:$A$3, $C$11:$C$13, the Range.EntireRow method will return $1:$13, not $1:$3,$11:$13 as would be expected. This also occurs when you use the Range.EntireColumn method to return entire columns when the Range is nonadjacent. WORKAROUNDTo return the correct rows or columns in a selection when the selection is nonadjacent, you must separate the selection into Areas, where an Area is defined as a single piece of a nonadjacent selection. This process is illustrated in the Visual Basic code example below. Visual Basic Code ExampleMicrosoft 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/overview/overview.aspNOTE: To convert this example to work with columns, use "Column" in place of "Row". To use the SelectRows Sub procedure, select any combination of cells on Sheet1. (This example assumes the current selection is $A$1:$A$3,$C$11:$C$13 on Sheet1.) Then, click Macro on the Tools menu, select the name SelectRows from the list of macro names, and click Run.
For example, if you select the range $A$1:$A$3,$C$11:$C$13 on worksheet
Sheet1 and then run the SelectRows Sub procedure, the procedure determines
how many Areas there are in the selection (there are two: $A$1:$A$3 and
$C$11:$C$13), determines which combination of rows encompasses each Area
($1:$3, $11:$13), and selects the range $1:$3,$11:$13.
STATUSMicrosoft has confirmed this to be a problem in the versions of Microsoft Excel listed at the beginning of this article. This problem was corrected in Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition. MORE INFORMATIONYou can create a nonadjacent selection by selecting a range and then selecting another range while holding down the CTRL key on your keyboard or by using Microsoft Excel version 4.0 or Visual Basic commands that select two or more ranges at the same time. Additional query words: 5.00a 5.00c 7.00a XL7 XL5 Selection.EntireRow Selection.EntireColumn
Keywords : kbprg PgmOthr PgmHowto |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |