With - End With
If you are going to perform several different actions on the same object use the With ....... End With.
This enables you to perform multiple operations on a single object.
After an object is assigned to a variable VBA can access it more quickly than it can a lengthy reference that has to be resolved.
The fewer the dots, the faster the processing time.
Another way to improve the speed is to use the With - End construct.
.Name = "Arial"
.Size = 12
link - docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/with-end-with-statement
Using With-End can speed things up but it does make the code harder to debug as you can't quickly drag expressions into the Watch Window.
© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext