View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Keep getting "Type mismatch"

If "h" is declared as an Integer (as you said it was), then that
transposition should not have changed anything... addition is not dependent
on order, so I am still puzzled as to why it didn't work originally.

--
Rick (MVP - Excel)



"Philosophaie" wrote in message
...
I found the problem. It was in the syntax:

I first entered:
deg(h) = CDbl(.Cells(2 + h, 3))

The fix was:
deg(h) = CDbl(.Cells(h+2, 3))

Just transposing the variable to the first position and the number to the
second fixed the anomaly.

Excel did not like the variable in second position like that.