Fastest way to reference a particular cell?

  • Thread starter Thread starter Maury Markowitz
  • Start date Start date
M

Maury Markowitz

Is there any "best way" to access the contents of a cell? IE, is there
any real difference between...

ActiveSheet.Cells(i,j)

or

ActiveSheet.Range("AB" & i)

Maury
 
Genearlly speaking I concur with Don in that there is no difference in what
you have posted...

Cells referes to a single cell where as range can refer to a group of cells.
Since there are differences though I do tend to use them under different
circumstances.

When I want a single cell referenced by some kind of variable I use Cells.
So in your example I would use Cells something like this
Cells(i, "AB")
I find createing a concatenated string to be awkward and at time error prone.

I tend to use range when the Cell reference is hard coded such as
Range("A1")
As I find that easier to read. I also use it when I need a range of cells
like this
=range(range("A1"), cells(i, "AB"))

That is my personal preference. The best thing that I can recommend is to be
consistent. It will make your code easier to read and understand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top