Building End With Work with userform
With - End With
allow us to perform various operations on an object without the need to reference it several times
.
For example ..
This example shows the reference Selection.Font 3 times .. but can be improved ..
The following macros check and be absolutely clear
Sub sinWITHENDW () 'Macro1
Selection.Font.Color = 255' color
source
Selection.Font.Bold = True 'Bold
Selection.Font.Italic = True 'itali
End Sub Sub
conWithEndWith ()' Macro2
With
Selection.Font
. Color = 255 'color
source. Bold = True' Bold
. Italic = True 'itali
End With End Sub
0 comments:
Post a Comment