I am looking at some code that Bill wrote in his "VBA and Macros For Excel 2007" book and it includes:
What is the benefit of releasing the variables? Since this is right before the End Sub, won't the variables be released when the code ends? Since I am new to VBA, I want to develop good habits - should all variables be set to Nothing before ending the code?
Thanks,
Jack
Code:
Dim WSD As Worksheet
Dim WSM As Worksheet
Dim WB As Wookbook
'
' other code that uses these variables
'
' Release Variables
Set WB = Nothing
Set WSD = Nothing
Set WSM = Nothing
End Sub
Thanks,
Jack