怎样使用VBA设置单元格的背景颜色
1、首先在开发工具中打开VBA编辑器

3、在VBA编辑器中插入模块

5、或者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) '背景的颜色蓝色End Sub
