Private Sub 核对_Click()
On Error Resume Next
Set mycnn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
mycnn.Open "Provider=Microsoft.jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=" & ThisWorkbook.FullName
For j = 3 To [A1].End(xlToRight).Column
For i = 2 To [A1].End(4).Row
rs.Open "Select * From [3月$A1:AX65535] Where 姓名 Like '" & Cells(i, 2) & "' And 日期 Like '" & Cells(1, j) & "'", mycnn, 1, 1
If Cells(i, j).Value <> IIf(IsNull(rs.Fields("有效生产工时")), 0, rs.Fields("有效生产工时")) Then Cells(i, j).Interior.Color = RGB(255, 255, 0)
rs.Close
Next
Next
mycnn.Close
End Sub