【发布时间】:2014-07-16 15:56:10
【问题描述】:
这里有一些代码给我一个对象定义或应用程序定义的错误。你们能帮忙吗?提前致谢
检查匹配细胞系时出现错误。
Sub check()
Dim y, x, xb As Integer
'vertical step
For y = 12 To 65
'check if cell have value
If Not IsEmpty(Sheet2.Cells(y, 4)) Then
'horizontal step
For x = 70 To 600
xb = x + 1
'checks for matching cell value
If Sheet2.Cells(6, x).Value = Sheet2.Cells(y, 4).Value Then
'sees if the next col over after match is empty
If Not IsEmpty(Sheet2.Cells(y, xb)) Then
'if not then highlight cell in col d
Sheet2.Cells(y, 4).Interior.ColorIndex = 3
End If
End If
Next x
End If
Next y
End Sub
【问题讨论】:
标签: vba if-statement for-loop