当前位置: 代码迷 >> VBA >> 一个有关问题 急
  详细解决方案

一个有关问题 急

热度:10300   发布时间:2013-02-26 00:00:00.0
一个问题 急 在线等
实现在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


------解决方案--------------------------------------------------------
哈哈 帮顶
  相关解决方案