Excel VBA 用编号引用单元格

通过使用行列编号,可用 Cells 属性来引用单个单元格。该属性返回代表单个单元格的 Range 对象。下例中,Cells(6,1) 返回 Sheet1 上的单元格 A6,然后将 Value 属性设置为 10。 By using the ranks of the number, the Cells property can be used to refer to a single cell. This property returns on behalf of a single cell Range object. In the following example, Cells (6,1) returns the cell on Sheet1 A6, and then set the Value property to 10.Sub EnterValue() Worksheets(“Sheet1”).Cells(6, 1).Value = 10End Sub因为可用变量替代编号,所以 Cells 属性非常适合于在单元格区域中循环,如下例所示。Variable substitution because the available number, so the Cells property is suitable for a range of cells in cycle, as shown.Sub CycleThrough() Dim Counter As Integer For Counter = 1 To 20 Worksheets(“Sheet1”).Cells(Counter, 3).Value = Counter Next CounterEnd Sub 上好网提示:如果要同时更改某一单元格区域中所有单元格的属性或对其应用方法,可使用 Range 属性。有关详细信息,请参阅用 A1 样式记号引用单元格。 Shanghao Network Tip: If you want to change all the cells in a range of cells in a property or method of its application, can use the Range property. For more information, please refer to the mark with the A1 style reference cell.
旅行要学会随遇而安,淡然一点,

Excel VBA 用编号引用单元格

相关文章:

你感兴趣的文章:

标签云: