Hi Gerry,
Welcome to the Excel forum.
Nice point about long/string. Sometimes the obvious is hard to see!
Regards
Malcolm
Hi Gerry,
Welcome to the Excel forum.
Nice point about long/string. Sometimes the obvious is hard to see!
Regards
Malcolm
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Hi Malcom,Originally Posted by mdmackillop
I do hope you reconsider that part. Cause clearing Objects explicitly with the keyword Nothing is still considerd good programming practise. And we do try to spread that kind of gospel with our knowledgebase...
We have talked about this subject before in the approvers forum but I can't find the thread al that easily but IMO we agreed on checking for correct closing and clearing of object references. (amongst things) A lot of KB's are checked on that issue.
Of course the decesion is up to you.
Amen to that brother!5. Sleep happy with the thought that if I forgot to release a variable, then the VBA gods will have taken pity on the little creature and done it for me.
Thanks to all.
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
Please STOP Gerry you're killing ME!Originally Posted by fumei
Priceless...Originally Posted by mdmackillop
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
One reason I don't do KBs, I got fed up of getting them returned for insignificant matters, and being forced to use Americanisms.Originally Posted by MOS MASTER
Killing you? Well I certainly don't want that.
That was a typo on my part, I meant strings and arrays, so used to writing strings and longs I was in auto.Originally Posted by fumei
And you BLOODY WELL CAN clear strings, as the larger they are, the more memory they take. Ditto arrays.
The only one to mention setting a string to nothing so far is you!Originally Posted by fumei
But do you know it doesn't? Don't bother answering that, you might rant on about modules not being strings.Originally Posted by fumei
He didn't re Longs, as I said above it was my typo.Originally Posted by fumei
I'm sorry you feel that way but I can totally relate to what you're saying. (A PITA though we lost you in that way cause you're are a very knowledgable person....)Originally Posted by xld
Perhaps things will change in the future.
</IMG>
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
Oddly enough, I hadn't noticed before, but my VBA ranking is greater than that possible for someone with only 3 KBsOriginally Posted by MOS MASTER
So if it works without it why do it. Couldn't the same be said for Option Explicit?
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
I did notice that before... Wouldn't know why...Originally Posted by xld
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
Steve it's NOT I repeat NOT proven yet that it does always work without it. But I agree it's a mather of preference if you use it.Originally Posted by lucas
And No Option Explicit is a totaly different subject and again relates to good programming practices and it helps you in many ways (example: by forcing you to declare your variables) writing your code.
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
I don't see where anything has been proven here one way or the other......The subject was good programing practice
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
If you mean it in that way the you should use it cause its considered good programming practice.Originally Posted by lucas
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
I think that's the underlying question here. I think that article by Matt Curland was very informative and educational. It will probably change some coding habits of mine and provoke some other testings to be completed.Originally Posted by lucas
I agree with Joost, it's not the same.Originally Posted by lucas
Thanks for such a thought provoking post MD! And to all those contributing, this truly is a great thread!
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
I'm just saying that our forum is directed towards folks learning(myself included). So shouldn't we be using top of the line methods as examples. Lots of code posted here without option explicit but when we publish to the kb its a different story. Hopefully this thread will help us sort and define what is good programing practice and we can come to a consensus on the subject.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Steve,Originally Posted by lucas
I think I agree with you on the first part. Neither Option Explicit nor setting to Nothing will give a problem ... in 99.9% of the cases (for serious developers).
But I know for a fact that Option Explicit save me making an error of wrongly using a variable that I haven't declared, and therby giving me a logic problem that might be very difficult to track down.
Others are saying that not setting object variables to nothing can also casue problems. Again, not every time perhaps, but again I would imagine that such a problem would be a bugger to track down.
As such, it could be argued that both are good examples of defensive programming. To my mind, that is nothing to do with style, but it is to do with programming practice. I definitely use Option Explicit implicitly, and I tend to also set object variables to Nothing, but not as religiously, because it doesn't hurt, and if it saves a problem down the line, then I am ahead of the game.
Then you should get hold of his book, it will turn your coding world upside down.Originally Posted by firefytr
And if you do get it, and you then understand it, perhaps you could explain it to me
It never will be, always is infinite. Can only prove the converse.Originally Posted by MOS MASTER
On this I agree in FULL!Originally Posted by xld
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
The holy grail will come to us eventually! (let's hope one of us stumbles up on it soon...)Originally Posted by xld
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)