View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Toggling navigating between 3 cells?

After serious thinking StargateFan wrote :
Rather than make various different buttons on my toolbar, it would be
much easier for users to press one button and toggle navigating to 2
specific and going back to A2 at last toggle. Can this be done?

i.e., from startpoint (whatever it is) go to D2
from D2 to G2 and then each time pressing navigation goes backwards:
G2 to D2
D2 to A2

Thanks! :oD


In the code behind the button, use a static var to monitor which cell
location the user is currently at. Each time the button is clicked,
advance the stored value.

So then...
1st click: set var to 1 (var=0 after startup)
2nd click: check var and set to next position (2 in this case)
3rd click: check var and set to next position (3 in this case)
4th click: check var and set to next position (1 in this case)

Optionally, you could use a global var instead of a local static var.

--
Garry

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