tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,926
- Office Version
- 365
- 2019
- Platform
- Windows
Is it necessary to always clear your variables in a loop?
For example, of the two methods below, which is preferable or are both the same?
or
Thanks
For example, of the two methods below, which is preferable or are both the same?
Code:
Dim MyVar As Class1
For Each Cell In Rng
Set MyVar = New Class1
Call MyVar.SomeMethod
Set MyVar = Nothing
Next Cell
or
Code:
Dim MyVar As Class1
Set MyVar = New Class1
For Each Cell In Rng
Call MyVar.SomeMethod
Next Cell
Thanks