一个问题 急 在线等
实现在excel 某列 用颜色标出 相同的单元格
代码如下, 单步是可以的,但不单步就出错了。
Private Sub CommandButton1_Click()
Dim j As Integer
Dim m As Integer
Dim i As Integer
j = 1
m = 2
For i = 1 To 20
For j = i + 1 To 20
If Sheet1.Cells(i, 3).Text = Sheet1.Cells(j, 3).Text Then
Cells(j, 3).Interior.ColorIndex = m + 1
Cells(i, 3).Interior.ColorIndex = m + 1
End If
Next j
If Sheet1.Cells(i, 3).Text = "" Then
GoTo mex
End If
m = m + 1
Next i
mex:
End Sub
[解决办法]
哈哈 帮顶