View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Set variable = nothing?

Raj,

A very interesting question, with differing opinions.

The obvious answer is yes, of course you should, otherwise memory is tied up
unnecessarily. However, Matthew Curland, who is a Microsoft Developer who
works on VB, whereby he scorned the practice as totally unnecessary,
breaking program flow, and adding to the size of your code.

I had an exchange of views with Dick Kusleika in these groups on the topic,
and my conclusion was that I am ready to take the chance of not setting to
Nothing, unless I want to clear it early in the code, use it as a
documentation aid to say that this object is no longer required. But .... if
I forget and set it to nothing, not something to lose sleep over.

If you want to read that exchange, try http://tinyurl.com/sr3o


HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"raj" wrote in message
...
Just a quick verification...

If one were to use the following code line:

Set xFind = Range(xColumn).Find("Total Equities")

Or for that matter, anytime the "Set" command is used,
shouldn't one always at some point later set the variable
equal to nothing?

For example,

Set xFind = Nothing

Thanks for your input.