ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is Range Offset property needed (https://www.excelbanter.com/excel-programming/444755-range-offset-property-needed.html)

Walter Briscoe

Is Range Offset property needed
 
Yesterday, I found something by accident.
I meant to access the cell above ActiveCell as ActiveCell.Offset(-1, 0).
Instead, I referred to ActiveCell(-1, 0) which seemed to refer to
ActiveCell.Offset(-2, -1).

I thought and concluded ActiveCell is equivalent to ActiveCell(1, 1).

I can now refer to the cell above the current cell as ActiveCell(0, 1).
Is this general?
--
Walter Briscoe

GS[_2_]

Is Range Offset property needed
 
Walter Briscoe wrote :
Yesterday, I found something by accident.
I meant to access the cell above ActiveCell as ActiveCell.Offset(-1, 0).
Instead, I referred to ActiveCell(-1, 0) which seemed to refer to
ActiveCell.Offset(-2, -1).

I thought and concluded ActiveCell is equivalent to ActiveCell(1, 1).

I can now refer to the cell above the current cell as ActiveCell(0, 1).
Is this general?


I like to create a fully relative locally defined name "LastCell" so it
will always refer to the cell above the cell using it in a formula.
This is great for cases where calcs change whenever rows are
added/removed, making the formulas somewhat dynamic.

Others I like to use a

LeftCell,RightCell,LastLeftCell,LastRightCell
NextCell (cell below)
NextLeftCell,NextRightCell

These provide enclosing the active cell in the center of a 9 cell grid.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com