VBA的with语句,即匹配对对象的属性赋值,和VBA的取对象属性

1 取对象的属性

1.1 取对象的属性

x= range("a6635").end(xlup).row

y=worksheets.count

1.2 引用对象的方法,执行一个动作

dict.add  1,"abc"

cells().delete

range().clearcontent

2 给对象的属性赋值

range().interior.colorindex=3

3 批量给对象的属性赋值

with 对象

  .属性1=属性值

  .属性2=属性值

  .属性3=属性值

  .属性4=属性值

end with

发布了384 篇原创文章 · 获赞 45 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/xuemanqianshan/article/details/104083908