ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inconsistent behaviour of attributes accessed through structured r (https://www.excelbanter.com/excel-programming/440416-inconsistent-behaviour-attributes-accessed-through-structured-r.html)

colin_e[_2_]

Inconsistent behaviour of attributes accessed through structured r
 
I have a table that represents information in an outline structure.

The table has two columns, "Level" and "Requirement" that look like this-

Level Requirement
1 Top Level
2 Next Level
2 Next Level again
3 Further sublevel
2 Back to Level 2

Now, what I want to two functions that will-

1) Set the indents of the "Requirements" column based on the level numbers,
or-

2) Se the Level numbers based on the indents of the Requirements column.

Sounds easy, And one way it is!

Can anyone explain why this works perfectly-

Dim oSh As Worksheet
Set oSh = ActiveSheet
oSh.Range("Reqts[Requirement]").IndentLevel =
oSh.Range("Reqts[Level]").Value

But the converse just sets all the "Level" values to zero?-

Dim oSh As Worksheet
Set oSh = ActiveSheet
' This should work but doesn't
' oSh.Range("Reqts[Level]").Value =
oSh.Range("Reqts[Requirement]").IndentLevel

I've got around it using a For Each loop for the second case, but the lack
of consistency bothers me. Is there a good reason why this works one way but
not the other?


All times are GMT +1. The time now is 09:11 PM.

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