With语句

本示例使用 With 语句对某单一对象执行一系列的语句。MyObject 对象及其属性均为示范目的而采用了通用名称。

With MyObject
   .Height = 100      '  MyObject.Height 一样等于 100 .Caption = "Hello World"   '  MyObject.Caption 一样等于 "Hello World" With .Font
      .Color = Red      '  MyObject.Font.Color 一样等于 Red.Bold = True      '  MyObject.Font.Bold 一样等于 True End With
End With

with sheet1
.range("a1")=...
.name=...
end with
原文地址:https://www.cnblogs.com/AntipasChen/p/7154923.html