Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA
VBA
Resolved · Low Priority · Version 2003
Alexis has attended:
Excel VBA Intro Intermediate course
VBA
when do you use code beginning with cell, and when do you use range?
For upcoming training course dates see: Pricing & availability
RE: VBA
Hi Alexis
There is no specific rule as to whether you refer to a cell by Range or Cells. For example:
Range("B3")
In Excel, the Range object has a method called Cells.
Note that Cells is a method - not an object. When the Cells method is evaluated, it returns an object (specifically, a Range object).
The Cells method takes two arguments: the row and the column. So the above range can also be written as:
Cells(3, 2)
The advantage of using the Cells method becomes apparent when you replace the arguments with variables.
Then you can use a loop to increment the variables and access a range of cells.
Hope this helps
Carlos
Mon 23 Mar 2009: Automatically marked as resolved.
|
