Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Magenta Ricci   on Nov 02 In MS Office Category.

  
Question Answered By: Adalwin Fischer   on Nov 02

Thanks for the response. I'll try to clarify what I'm trying to do.

I'm trying to write a macro that I will link to a button on my mouse.
When the button is pressed, the active cell will jump 3 cells to the
right. But if there are 2 vertically adjacent cells active, it will
jump 6 cells to the right. If three vertically adjacent cells are
selected, the active cell will jump 9 cells to the right. And so forth.
The number of vertically adjacent cells active will modify the jump
size.

But here's the hitch. If only one cell is active, I want the subroutine
to repeat the previous jump size.

To accomplish this, I want my single subroutine  to remember a value "x"
which will store the number of vertically adjacent cells that were
selected in the previous execution. This way, whatever I set my jump
size to be will persist until I change it by selecting a different
number of vertically adjacent cells when I press the button.

Does this make sense?

In summary, I want to create a single subroutine, that remembers the
value of "x" from execution to execution.

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on how to preserve variable value between subroutine calls? Or get search suggestion and latest updates.


Tagged: