范围对象的范围对象
Range object's Range object
我们应该如何解读以下内容?
Range("A2:A3").Range("E2:E3").Select
想不到,上面代码的结果是怎么来的。我试过好几次了,但是我不能。
是相对参照。在这种情况下,您会 select E3:E4 因为 Excel 会假设您的活动范围从 A2 开始(即 A2 = A1)。
见https://msdn.microsoft.com/EN-US/library/office/ff834676.aspx
When applied to a Range object, the property is relative to the Range
object. For example, if the selection is cell C3, then
Selection.Range("B1") returns cell D3 because it’s relative to the
Range object returned by the Selection property. On the other hand,
the code ActiveSheet.Range("B1") always returns cell B1.
我们应该如何解读以下内容?
Range("A2:A3").Range("E2:E3").Select
想不到,上面代码的结果是怎么来的。我试过好几次了,但是我不能。
是相对参照。在这种情况下,您会 select E3:E4 因为 Excel 会假设您的活动范围从 A2 开始(即 A2 = A1)。
见https://msdn.microsoft.com/EN-US/library/office/ff834676.aspx
When applied to a Range object, the property is relative to the Range object. For example, if the selection is cell C3, then Selection.Range("B1") returns cell D3 because it’s relative to the Range object returned by the Selection property. On the other hand, the code ActiveSheet.Range("B1") always returns cell B1.