View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
m.s.w m.s.w is offline
external usenet poster
 
Posts: 4
Default When true isn't true - help for newbie

K Dales wrote:
If you are sure that X.Value is 1200 and X.List(K) is also 1200, then they
must be different variable types (e.g. one is a string) for ItFits to turn
out False. Put a breakpoint in your code on the line ItFits=True. When the
code breaks, go to the immediate pane and type the following:
? X.Value
? VarType(X.Value)
? X.List(K)
? VarType(X.List(K))
Look in Help or the object browser for the meaning of the corresponding codes.
This should be instructive in determining why you are getting ItFits=False.
3 possibilities:
1) for some reason the code is never reaching this line, so ItFits retains a
False value
2) the values are not what you think they are
3) the variables are incompatible types


Thank you very much. That gave me a very surprising informations.
TO clarify:
ListFillRange is a range of cells (a column) with values:
200
500
650
800
1000
1200
1500
2000

When I did what you just said it showed to me that X.List(K) is a
Double-precision floating-point number, and the X.Value is a String
That's a surprise for me.
Why it doesn't breaks with "Type mismatch" error message?

Thanks anyway. I'll check the CInt or CStr (or not?).

Thank you,
m.s.w