Undo button??

B

Bruise

Has anyone ever heard of a code that would function as an undo button? My
spreadsheet requires staff to make many entries throughout the day.
Sometimes they get distracted with phone calls and lose their spot. I would
like to add an 'undo' button that would 'undo' their last 1 or 2 entries. I
thought of just closing without saving, but then they would lose all their
other entries, as well.

Any suggestions?

TIA...
Mark
 
R

RB Smissaert

You will need to keep track of all the changes in such a way that you can
trace back.
For example you could make a VBA collection holding 1-D arrays with 4
elements.

In these array elements you would then have:
Row number
Column number
Cell text or value before change
Cell text or value after change

Any changed cell would add an item to the collection with this information.
If something goes wrong you would just trace back x number of steps.
You would need to work it all out, but it is fairly simple.

RBS
 
D

davegb

Bruise said:
Has anyone ever heard of a code that would function as an undo button? My
spreadsheet requires staff to make many entries throughout the day.
Sometimes they get distracted with phone calls and lose their spot. I would
like to add an 'undo' button that would 'undo' their last 1 or 2 entries. I
thought of just closing without saving, but then they would lose all their
other entries, as well.

Any suggestions?

TIA...
Mark

Maybe I'm naive, but what's wrong with the Undo button?
 
D

dominicb

Good evening dave_gb

The undo button doesn't work to undo a macro - you have to code your
own routine, but you can link it into the undo button, so a user
wouldn't normally notice the difference. This is what the OP was
after.

Bruise

John Walkenbach discusses this with a simple example here:

http://www.j-walk.com/ss/excel/tips/tip23.htm

HTH

DominicB
 
D

davegb

RB said:
You can't trace back very far with that.

If I remember right, it depends on how much memory you're got. At work,
I've got 1G, so I can go back a long way.
 
D

davegb

dominicb said:
Good evening dave_gb

The undo button doesn't work to undo a macro - you have to code your
own routine, but you can link it into the undo button, so a user
wouldn't normally notice the difference. This is what the OP was
after.

I congratulate you! You're psychic!
Clearly, I'm not. :)
 
R

RB Smissaert

Not sure it depends on available memory.
I got 1G as well, but I can only do 16 undo's.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top