如何用VBA编程,将Excel表格里A列的内容根据单元格背景颜色做出调整 10
展开全部
我给你一个判断单元格是否有底色的代码,你在根据自己的要求修改代码即可
Sub abc()
Dim rng As Range, rng1 As Range
Dim y As Integer
Set rng = Range("a1:d9") ''''A1:D9区域
For Each rng1 In rng
y = rng1.Interior.ColorIndex ''''单元格颜色标记数
If y > 0 Then MsgBox rng1.Address ''''如果Y>0,则提示该单元格的地址
Next
End Sub
Sub abc()
Dim rng As Range, rng1 As Range
Dim y As Integer
Set rng = Range("a1:d9") ''''A1:D9区域
For Each rng1 In rng
y = rng1.Interior.ColorIndex ''''单元格颜色标记数
If y > 0 Then MsgBox rng1.Address ''''如果Y>0,则提示该单元格的地址
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询