ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Resetting a variable to nothing (https://www.excelbanter.com/excel-programming/289251-resetting-variable-nothing.html)

Todd Huttenstine[_3_]

Resetting a variable to nothing
 
How do I set a variable to nothing?



Rob van Gelder[_4_]

Resetting a variable to nothing
 
Todd,

Set variable = Nothing


Rob

"Todd Huttenstine" wrote in message
...
How do I set a variable to nothing?





tolgag[_27_]

Resetting a variable to nothing
 
Actually you don't have to set regular variables to nothing; it's onl
for object variables

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Resetting a variable to nothing
 
And it is debatable whether you even need to set these to nothing. See
http://tinyurl.com/2sdxp for a previous exchange on this topic.

--

HTH

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

"tolgag " wrote in message
...
Actually you don't have to set regular variables to nothing; it's only
for object variables.


---
Message posted from http://www.ExcelForum.com/




Paul Robinson

Resetting a variable to nothing
 
Hi
If it is an object variable use

Set object = Nothing

This is done to release memory. For other variables (Boolean, Double
etc) you should not need to set their value to nothing. A variable
defined inside a sub for example only exists for the lifetime of that
sub. During the sub, the variable is initialised to have some value
(otherwise you wouldn't define it in the first place) and ceases to
exist in memory at the end of the sub. There should not be a reason to
say the variable has no value - I don't know a lot about the memory
implications of variable declarations in VB mind, so don't take this
as Gospel!

regards
Paul


"Todd Huttenstine" wrote in message ...
How do I set a variable to nothing?



All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com