展开全部
Sub s()
Set rg = [k:q]
c = 20
x = rg.Column
y = x + rg.Columns.Count - 1
n = Cells(Rows.Count, x).End(3).Row
For i = n To n - c + 1 Step -1
If i = 1 Then Exit For
f = True
For j = x To y
If Cells(i, j) = Cells(i - 1, j) Then
f = False
Cells(i, j).Interior.ColorIndex = 7
End If
Next
If f Then Range(Cells(i, x), Cells(i, y)).Interior.ColorIndex = 6
Next
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
VBA代码如下:
Sub s()
Set rg = [k:q]
c = 20
x = rg.Column
y = x + rg.Columns.Count - 1
n = Cells(Rows.Count, x).End(3).Row
For i = n To n - c + 1 Step -1
If i = 1 Then Exit For
f = True
For j = x To y
If Cells(i, j) = Cells(i - 1, j) Then
f = False
Cells(i, j).Interior.ColorIndex = 7
End If
Next
If f Then Range(Cells(i, x), Cells(i, y)).Interior.ColorIndex = 6
Next
End Sub
Sub s()
Set rg = [k:q]
c = 20
x = rg.Column
y = x + rg.Columns.Count - 1
n = Cells(Rows.Count, x).End(3).Row
For i = n To n - c + 1 Step -1
If i = 1 Then Exit For
f = True
For j = x To y
If Cells(i, j) = Cells(i - 1, j) Then
f = False
Cells(i, j).Interior.ColorIndex = 7
End If
Next
If f Then Range(Cells(i, x), Cells(i, y)).Interior.ColorIndex = 6
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Range("A1:A2").Interior.ColorIndex = 3
类似这种,只需要去更改range区域即可!
类似这种,只需要去更改range区域即可!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |