我很困惑为什么在运行此代码时出现类型不匹配错误。
我要做的就是记录c
的值以进行调试,但我甚至无法做到这一点。
这是我的代码:
Dim c As Range
Dim queryaddress As Range
For Each queryaddress In worksheetname.Range("B2:B21")
Set queryrow = queryaddress.EntireRow
For Each c In queryrow
Debug.Print (c.Interior.Color)
Debug.Print (c.Address)
If WorksheetFunction.CountA(c) > 0 And c.Interior.Color = 0 Then
Debug.Print (c.Value)
'The above line creates a mismatch error
End If
Next c
Next queryaddress