tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
Is it good practice to clear an object variable before using it?
For example:
is this line good practice?
Thanks
For example:
Code:
Option Explicit
Sub ClearingObjects()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Cells(1, 1).Value = 1
Set ws = Nothing
Set ws = Worksheets("Sheet2")
ws.Cells(1, 1).Value = 2
Set ws = Nothing
End Sub
is this line good practice?
Code:
Set ws = Nothing
Thanks