Set variable = nothing?
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. |
Set variable = nothing?
If it is a local variable and the routine ends, it is cleaned up anyway
because it goes out of scope. So it isn't necessary/essential. -- Regards, Tom Ogilvy "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. |
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. |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com