The SETATREFEXPR is tricky. When you move the sub-shape by hand, the bit inside the parentheses will change, according to Visio's standard, proportional positioning inside a group. So: if I move a sub-shape so that it is all the way to the bottom, then this:
PinY = SETATREF(User.dy,SETATREFEVAL(SETATREFEXPR(Sheet.3!Height*0.9946)-Sheet.3!Height))+Sheet.3!Height
will change to this:
PinY = SETATREF(User.dy,SETATREFEVAL(SETATREFEXPR(Sheet.3!Height*0)-Sheet.3!Height))+Sheet.3!Height
and User.dy will be equal to minus the entire height of the group. But User.dy will be a number, not a formula. So the resulting PinY of the sub-shape will be "group height-what the group height was" = 0, until we change the height of the group.