Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some code on a workbook and I want to clear out all the dim statements
so I can use them again further down in the code Is there any way this can be achieved |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The question is a little unclear. Is this a matter that within a single sub
routine you have declared some vairables and you want to clear them and reuse them again in the same sub routine, or are you using the same variable name in more than one sub? For a quick and over simplified description, when you declare a varaible within a Sub or Function a memory spot is reserved on the stack. That memory spot will exist until the end of the procedure at which point the stack is cleared and the variable is gone. The exception to this is if the vairable in the sub was declared as static. If it was declared static or it was declared globally then it is stored on the Heap and the memory allocation persists until the program (spreadsheet) is closed. In any one procedure you can not declare the same variable name twice. You can clear the value in the variable, (make it 0, false, nothing, empty, "", ...). You can use the same variable name in more than one sub. That is to say that you can declare "Dim i As Integer" in as many subs as you want. Not sure if this helps but there it is. -- HTH... Jim Thomlinson "Nigel" wrote: I have some code on a workbook and I want to clear out all the dim statements so I can use them again further down in the code Is there any way this can be achieved |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Transfer a name from one cell to another but leave clear if clear? | Excel Worksheet Functions | |||
If then Statments | Excel Worksheet Functions | |||
If statments | Excel Worksheet Functions | |||
If Statments | Excel Discussion (Misc queries) | |||
clear the clear the web page email attachment lines | Excel Discussion (Misc queries) |