JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 516
- Office Version
- 365
- Platform
- Windows
Hi All,
I am in the process of cleaning up my code and cant seem to find an answer to this one.
Often I do.....
Sub ABC
With Sheet1
End With
With Sheet2
End With
With Sheet3
End With
End Sub
All I ever see is:
Dim ws as worksheet
Set ws = Sheeet1
With ws
End With
My questions are:
1, To make my code "cleaner" should I be changing the Set statement every time I change the With Statement?
2. With a Nested With statement, should I also be adding the Set statement?
My code works fine now, however, I do suspect that the structure of code is the cause of the occasional runtime errors that I get.
As always, thanks for your help.
I am in the process of cleaning up my code and cant seem to find an answer to this one.
Often I do.....
Sub ABC
With Sheet1
End With
With Sheet2
End With
With Sheet3
End With
End Sub
All I ever see is:
Dim ws as worksheet
Set ws = Sheeet1
With ws
End With
My questions are:
1, To make my code "cleaner" should I be changing the Set statement every time I change the With Statement?
2. With a Nested With statement, should I also be adding the Set statement?
My code works fine now, however, I do suspect that the structure of code is the cause of the occasional runtime errors that I get.
As always, thanks for your help.