怎样使用VBA把字体设置为粗体?
1、首先在开发工具中打开VBA编辑器
2、在单元格区域当中输入一些内容作为例子
3、在VBA编辑器中插入模块
4、在模块当中输入如下代码,然后运行
Sub adc()
On Error Resume Next '出错继续执行后面的代码
'Worksheets("Sheet1").Range("A1").Font.ColorIndex = 3
'Selection.Font.ColorIndex = 5
'Range("A1:A11").Select '选择辅助的区域
'Selection.Copy '复制
'Range("A13").Select '选择粘贴的第一个单元格
'ActiveSheet.Paste '粘贴
'Selection.Font.ColorIndex = 5 '字的颜色号为3 红色
'Selection.Interior.ColorIndex = 44 ' 背景的颜色为3 红色
'Selection.Font.Color = RGB(0, 255, 0) '字的颜色绿色
'Selection.Interior.Color = RGB(0, 0, 255) '背景的颜色蓝色
Selection.Font.Bold = True
End Sub
5、最后就可以看到我们所选择的区域的字体变成了粗体,
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:26
阅读量:26
阅读量:36
阅读量:60
阅读量:34