VBA中2个具有相同值的单元格的比较返回错误的输出

所以我有这个代码列出了所有的表格,并将第二行的单元格与第十一行的单元格进行比较。 如果它们不匹配,则将其颜色更改为红色:

Dim tbl As ListObject Dim sht As Worksheet Dim i As Integer 'Loop through each sheet and table in the workbook For Each sht In ThisWorkbook.Worksheets For i = 1 To 1000 If sht.Cells(1, i) <> vbNullString Then If sht.Cells(2, i).Value = sht.Cells(11, i).Value Then sht.Cells(2, i).Interior.Color = xlNone sht.Cells(11, i).Interior.Color = xlNone Else sht.Cells(2, i).Interior.Color = RGB(255, 0, 0) sht.Cells(11, i).Interior.Color = RGB(255, 0, 0) End If Else Exit For End If Next i 

但是在一个选项卡中,它也会为一些匹配单元格着色。 我正在比较的数据是导出的csv。 如果我手动重写比较的单元格的值,并运行代码的结果是正确的。 单元格的格式在两行中都是一般的。 任何想法如何解决这一问题?

在这里输入图像说明