两个工作簿,工作表数量较多,怎么实现查找两个工作簿之间重复的单元格并填充颜色?主要是B列小白一枚,自己写了一段,提示下标越界了
Sub 查重()
Dim i As Integer, j As Integer
Dim mrng As Range
For i = 1 To Workbooks("cq5.xlsx").Sheets.Count
For j = 1 To Workbooks("cq5.xlsx").Sheets(i).Range("A65536").End(xlUp).Row
Set mrng = Workbooks("cq61.xlsx").Cells.Find(Workbooks("cq5.xlsx").Sheets(i).Range("B" & j))
If Not mrng Is Nothing Then
mrng.Interior.Color = 5296274
End If
Next j
Next i
End Sub