ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to store Range for "home-made" Undo Function? (https://www.excelbanter.com/excel-programming/393341-how-store-range-home-made-undo-function.html)

Joe HM

How to store Range for "home-made" Undo Function?
 
Hello -

I have restriced inserting and deleting rows on a Worksheet to make
users use functionality of a custom toolbar. That way I can make sure
that formatting stays consistent.

I am now trying to make an undo function after the deletion of a row.
Currently I store the .Value and other . entries in global variables
but it seems like there should be an esier way.

I tried to define a ...
Public mRange as Range
and then assign ...
Set mRange = lSheet.Range(...)
.... but when I try to access mRange from within another function, it
seems to have lost all the data.

How can I create a copy of the range and store it in a variable in
order to restore it later on?

Thanks,
Joe


Wigi

How to store Range for "home-made" Undo Function?
 
Joe, what is often done, is use an extra hidden worksheet (xlHidden or
xlVeruHidden) where you store some data.


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Joe HM" wrote:

Hello -

I have restriced inserting and deleting rows on a Worksheet to make
users use functionality of a custom toolbar. That way I can make sure
that formatting stays consistent.

I am now trying to make an undo function after the deletion of a row.
Currently I store the .Value and other . entries in global variables
but it seems like there should be an esier way.

I tried to define a ...
Public mRange as Range
and then assign ...
Set mRange = lSheet.Range(...)
.... but when I try to access mRange from within another function, it
seems to have lost all the data.

How can I create a copy of the range and store it in a variable in
order to restore it later on?

Thanks,
Joe



Joe HM

How to store Range for "home-made" Undo Function?
 
Hello -

That might work for me ... I need to check it out. It's just a little
weird that there seems to be no other way to do this ...

Thanks!
Joe


On Jul 14, 5:12 am, Wigi wrote:
Joe, what is often done, is use an extra hidden worksheet (xlHidden or
xlVeruHidden) where you store some data.

--
Wigihttp://www.wimgielis.be= Excel/VBA, soccer and music



"Joe HM" wrote:
Hello -


I have restriced inserting and deleting rows on a Worksheet to make
users use functionality of a custom toolbar. That way I can make sure
that formatting stays consistent.


I am now trying to make an undo function after the deletion of a row.
Currently I store the .Value and other . entries in global variables
but it seems like there should be an esier way.


I tried to define a ...
Public mRange as Range
and then assign ...
Set mRange = lSheet.Range(...)
.... but when I try to access mRange from within another function, it
seems to have lost all the data.


How can I create a copy of the range and store it in a variable in
order to restore it later on?


Thanks,
Joe- Hide quoted text -


- Show quoted text -





All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com