Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range Reference 1

Status
Not open for further replies.

PeterAB

Chemical
Feb 8, 2002
33
0
0
CA
Is it possible to refer to a range of cells using index numbers, rather than using A1 notation?

I want to write a generic cell-range copy routine, that will copy variable-size ranges from some Cell(row A, column A) through to Cell(row B, column B), to a new location anchored at Cell(row C, column C). Only thing is, I only have row and column numbers to work with, and would prefer not having to translate that into A1 notation.

Thanks
Peter.
 
Replies continue below

Recommended for you

Peter,
I assume you are asking about VBA manipulations, not worksheet functions. Use statements Cells(row, column) to access cells not using alphabetical notations. Within a certain range the indexes will be local. range.cells(row, column). To create a range use statements like
Set rng = cells(row, column).resize(Nrows, Ncolumns)

hope it helps!
 
Thanks Yakpol!

I tried it and it works like a charm.
I'm embarrased to say how long I had spent searching through Excel's VBA online help and getting nowhere. Then I post my question here just before leaving work, and found the answer waiting for me the next day. I love this forum.

PeterAB.
 
Hello,

If you think this forum site is good (which it is) for Excel and Access questions visit mrexcel.com



----------------------------------
Hope this helps.
----------------------------------

maybe only a drafter
but the best user at this company!
 
Status
Not open for further replies.
Back
Top