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

I'm guessing "h" is a loop variable... what values does it iterate over?
Also, **exactly** what is in your cells that you are trying to convert (show
us an example or two)? Also, I see a "dot" in front of the Cells call...
what is it having the cell refer back to?

--
Rick (MVP - Excel)



"Philosophaie" wrote in message
...
Neither of these cases work. I just get a "Type mismatch" error.

Dim deg(10), min(10), sec(10), DEGt(10) as Double

deg(h) = CDbl(.Cells(2 + h, 3))
min(h) = CDbl(.Cells(2 + h, 4))
sec(h) = CDbl(.Cells(2 + h, 5))
DEGt(h) = deg(h) + min(h))/ 60 + sec(h) / 3600
or
deg(h) = .Cells(2 + h, 3)
min(h) = .Cells(2 + h, 4)
sec(h) = .Cells(2 + h, 5))
DEGt(h) = CDbl(deg(h)) + CDbl(min(h)) / 60 + CDbl(sec(h)) / 3600