Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array Maintaining its values after execution
Apologies for starting a new thread, however I could not see a means
of adding to the existing discussion http://groups.google.com/group/micro...&rnum=1&hl=en# Unlike the previous poster I wish to retain the values of my arrays after code execution (in order to repopulate previously captured data on a user form if the user wishes to change their mind after initial submission). Running Excel 2003. However, wherever i declare my array be it globally in a module or ThisWorkbook it always clears itself after code execution. To be honest this is the behaviour I expected and I was surprised with Tom Olgivy's answer that a global variable will retain its value for the life of the workbook. I was expecting to have to add something extra to the declaration. Any help greatly appreciated. Simon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array Maintaining its values after execution
Dim s(2) As Integer
Sub demo() MsgBox (s(0)) MsgBox (s(1)) s(0) = s(0) + 1 s(1) = s(1) + 1 End Sub repeated execution of demo will show the values are retained -- Gary''s Student - gsnu200723 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array Maintaining its values after execution
the public declaration should be in a general module not in
worksheet module thisworkbook module userform module -- Regards, Tom Ogilvy " wrote: Apologies for starting a new thread, however I could not see a means of adding to the existing discussion http://groups.google.com/group/micro...&rnum=1&hl=en# Unlike the previous poster I wish to retain the values of my arrays after code execution (in order to repopulate previously captured data on a user form if the user wishes to change their mind after initial submission). Running Excel 2003. However, wherever i declare my array be it globally in a module or ThisWorkbook it always clears itself after code execution. To be honest this is the behaviour I expected and I was surprised with Tom Olgivy's answer that a global variable will retain its value for the life of the workbook. I was expecting to have to add something extra to the declaration. Any help greatly appreciated. Simon |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Array Maintaining its values after execution
On May 21, 3:29 pm, Tom Ogilvy
wrote: the public declaration should be in a general module not in worksheet module thisworkbook module userform module -- Regards, Tom Ogilvy " wrote: Apologies for starting a new thread, however I could not see a means of adding to the existing discussion http://groups.google.com/group/micro...rogramming/bro... Unlike the previous poster I wish to retain the values of my arrays after code execution (in order to repopulate previously captured data on a user form if the user wishes to change their mind after initial submission). Running Excel 2003. However, wherever i declare my array be it globally in a module or ThisWorkbook it always clears itself after code execution. To be honest this is the behaviour I expected and I was surprised with Tom Olgivy's answer that a global variable will retain its value for the life of the workbook. I was expecting to have to add something extra to the declaration. Any help greatly appreciated. Simon Thanks to you both, have sorted it out now |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listing unique values, frequency, and maintaining list order integrity | Excel Worksheet Functions | |||
search an array for values contained in another array | Excel Programming | |||
Maintaining cell 'variable' values even after the the macro has en | Excel Programming | |||
Maintaining VBA variable values | Excel Discussion (Misc queries) | |||
Automatic Macro Execution Upon Cell Values Changing | Excel Programming |