Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 3933|回复: 3

[已解决]VBA设置EXCEL当前工作表,所有单元格格式。

[复制链接]
发表于 2013-11-26 20:41 | 显示全部楼层 |阅读模式
VBA设置EXCEL当前工作表,所有单元格格式。


设置当前工作表,所有单元格,文字对齐方式为居中、字体仿宋、三号、

请教VBA代码。
最佳答案
2013-11-26 21:10
也可以写在一起
  1. Sub test()
  2.     With ActiveSheet.Cells
  3.         .HorizontalAlignment = xlCenter '水平居中
  4.         .VerticalAlignment = xlCenter '上下居中
  5.         .Font.Name = "仿宋_GB2312"
  6.         .Font.Size = 14
  7.     End With
  8. End Sub
复制代码
发表于 2013-11-26 21:08 | 显示全部楼层
  1. Sub test()
  2.     With ActiveSheet.Cells
  3.         .HorizontalAlignment = xlCenter '水平居中
  4.         .VerticalAlignment = xlCenter '上下居中
  5.     End With
  6.     With ActiveSheet.Cells.Font
  7.         .Name = "仿宋_GB2312"
  8.         .Size = 14
  9.     End With
  10. End Sub
复制代码
回复

使用道具 举报

发表于 2013-11-26 21:10 | 显示全部楼层    本楼为最佳答案   
也可以写在一起
  1. Sub test()
  2.     With ActiveSheet.Cells
  3.         .HorizontalAlignment = xlCenter '水平居中
  4.         .VerticalAlignment = xlCenter '上下居中
  5.         .Font.Name = "仿宋_GB2312"
  6.         .Font.Size = 14
  7.     End With
  8. End Sub
复制代码
回复

使用道具 举报

 楼主| 发表于 2013-11-27 09:48 | 显示全部楼层
fjmxwrs 发表于 2013-11-26 21:10
也可以写在一起

谢谢版主的帮助!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-18 15:17 , Processed in 0.210004 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表