I have this condition in an if statement:
If myDict.Exists(Cells(d.Row, d.Column - 1)) Then
At a particular step in the code (while stepping through it), the following code in the Immedi开发者_C百科ate window
MsgBox Cells(d.Row,d.Column-1)
gives me a value of "1/3/2011"
And at that very step,
MsgBox myDict.Item("1/3/2011")
returns a value too.
However, my if condition posted above does not equate to true. Why??
Do I need to be casting the result of Cells(d.Row,d.Column-1) as a certain type?
Cells returns an object. I usually just cast the cell into a range: ((XL.Range)Cells(d.Row,d.Column-1)).Value2.ToString(). Then compare the strings.
精彩评论