请VB高手指教,急、急、急、急、急、急、急、急!!!!
我有很多excel文件,现在想写个脚本,脚本运行时,系统自动检查每个excel中指定的列,做一次循环,并把这一列中所有单元格内容重复的信息提示给用户。。请高手赐教。最好有代码和说明,小弟万分感谢!!! VB操作Excel的代码 最好有代码和说明,楼上怎么搞的,给个连接就OK了? oooooooooo
这位大哥,你给的连接是什么啊,看不懂啊。。。。。麻烦请详细说明下好不 EXCEL 宏代码(VBA),测试通过!
msailsoft兄弟,你测试通过了,为什么到我这就通不过呢。还请指点迷津哈!!。。。
Dim lRows As Long
Dim lCols As Long
Dim arrCell() As String
lRows = Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row
lCols = Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Column
ReDim arrCell(1 To lRows * lCols, 0 To 2) As String
Dim i As Long
Dim j As Long
Dim arrCount As Long
Dim m As Long
arrCount = 0
For i = 1 To lRows
For j = 1 To lCols
arrCount = arrCount + 1
arrCell(arrCount, 0) = i
arrCell(arrCount, 1) = j
arrCell(arrCount, 2) = Excel.ActiveWorkbook.Sheets(1).Cells(i, j)
Next
Next
Dim s1 As String
Dim s2 As String
For i = 1 To lRows
For j = 1 To lCols
s1 = Excel.ActiveWorkbook.Sheets(1).Cells(i, j)
s1 = Trim(s1)
For m = 1 To arrCount
If arrCell(m, 0) = i And arrCell(m, 1) = j Then
Else
s2 = arrCell(m, 2)
s2 = Trim(s2)
If s1 = s2 Then
MsgBox ("重复单元格:" & Str(i) & "," & Str(j) & " 与 " & Str(arrCell(m, 0)) & "," & Str(arrCell(m, 1)))
Exit For
End If
End If
Next
Next
Next
你是在Excel里面按Alt+F11键在Excel VBA环境下运行代码的吗?
补充:VB , VBA