vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA

VBA

resolvedResolved · 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?

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.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Removing border lines on the keyboard

Highlight your cell(s) that have boreders on them and press CTRL + SHIFT + _, this will then remove the border lines.

View all Excel hints and tips


Server loaded in 0.08 secs.