Sheet.Range.Value与Sheet.Range.Cells之间的差异

问题描述 投票:0回答:1

我很好奇Sheet.Range.Value和Sheet.Range.Cells有什么区别?我知道前者正在从指定范围内获取价值,而后者我不确定。有谁知道它是什么?

vba excel-vba cell
1个回答
-1
投票

这里有关于范围与单元格的很好的解释:https://stackoverflow.com/a/51097214

[PEH那里有一个简明的表格(https://stackoverflow.com/a/51096156,如下所示。]

Range("A1:A2")              'range can return multiple cells …
Range("A1")                 '… or one cell.
Cells(1, 2)                 'cells can return one cell or …
Cells                       '… all cells of the sheet

Range("A1:A2").Cells        'returns all cells of that range and therefore is the same as …
Range("A1:A2")              '… which also returns all cells of that range.

Range("C5:C10").Cells(2, 1) 'returns the second row cell of that range which is C6, but …
Cells(2, 1)                 'returns the second row cell of the sheet which is A2
© www.soinside.com 2019 - 2024. All rights reserved.