how to find cells with “#VALUE!” in EXCEL 2010 VBA
问题 I need to find the max value in a column by EXCEL 2012 VBA. Some cells have "#VALUE!". My code does not work. Sub find_max() Dim rng As Range Dim dblMax As Double dblMax = 0 Set rng = Range("A2:A11") For Each cell In rng If (cell.Value <> "#VALUE!") Then // error ! type mismatch If dblMax < CDbl(cell.Value) Then dblMax = CDbl(cell.Value) End If End If Next cell MsgBox dblMax End Sub I also need to print the cell location (mark it with a color) with the max value. Any help would be appreciated