Hi I am trying to work out a simple way to loop through what is effectively a binomial option tree.
2
So it starts with node (1) that then branches off
3
The tree is of indeterminate size, and some nodes will end before others. So I effectively need to loop through it just printing the value if there is one down each option path, and stop looping when all the paths have been run.
I was originally thinking something like
Sub Loop()
Dim Count as String
Do While ActiveCell.Value <>Empty
For Count = -1 To 1
ActiveCell.Value = ActiveCell.Value *2 `Or any other action just to show that it has been looped through
ActiveCell.Offset(Count, 1)
Loop
But that just seems to run off in one direction. So the issue I'm having is telling the loop to explore all possible paths.
Thank you.
2
So it starts with node (1) that then branches off
3
The tree is of indeterminate size, and some nodes will end before others. So I effectively need to loop through it just printing the value if there is one down each option path, and stop looping when all the paths have been run.
I was originally thinking something like
Sub Loop()
Dim Count as String
Do While ActiveCell.Value <>Empty
For Count = -1 To 1
ActiveCell.Value = ActiveCell.Value *2 `Or any other action just to show that it has been looped through
ActiveCell.Offset(Count, 1)
Loop
But that just seems to run off in one direction. So the issue I'm having is telling the loop to explore all possible paths.
Thank you.