Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Clear Dim Statments

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Clear Dim Statments

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer a name from one cell to another but leave clear if clear? Scoober Excel Worksheet Functions 3 May 22nd 09 02:55 AM
If then Statments Tina Excel Worksheet Functions 5 January 20th 09 09:43 PM
If statments Lweiss Excel Worksheet Functions 2 March 20th 08 08:01 AM
If Statments Jason Excel Discussion (Misc queries) 2 January 3rd 08 05:33 PM
clear the clear the web page email attachment lines MCrider Excel Discussion (Misc queries) 0 November 11th 07 10:05 PM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"