NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Offset behavior - 0/1 bug?

IainDM opened this issue · comments

suppose I have a variable Range baseRange, which points to cell E10. Then baseRange.Offset[0,0] should also point to E10. But it points to D9.

Indexing in macros, Visual Basic and Office APIs are 1 based.

Yes, I agree, that's true for indexes for methods like Cell[x,y]. But not for Offset.

For example:

Using the Office Interop Assemblies, Range["A1"].Offset[0, 0].Address = "$A$1"
In VBA, MsgBox Range("b5").Offset(0, 0).Address shows a message box with $B$5

@jozefizso thank you.