View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_4_] Bob Phillips[_4_] is offline
external usenet poster
 
Posts: 834
Default Keep getting "Type mismatch"

Try this

Dim deg(1 To 25) As Double, min1 To 25) As Double, sec1 To 25) As Double
Dim DEGt(1 To 25) As Double, Zodiac(25) As Double
For h = 1 To 25
If .Cells(2 + h, 3) = "" Then
DEGt(h) = ""
GoTo 10
End If
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
Zodiac(h) = CStr(.Cells(2 + h, 2))
10:
Next h

--

HTH

Bob

"Philosophaie" wrote in message
...
'I do not understand this error. I first tried without the if statement
and
10: that was not the problem. I tried changing the dim statement from 25
to
23 that did not work. I think I am initilizing it right. Just not sure.

Dim deg(25), min(25), sec(25), DEGt(25), Zodiac(25) As Double
For h = 1 To 23
If .Cells(2 + h, 3) = "" Then
DEGt(h) = ""
GoTo 10
End If
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
Zodiac(h) = CStr(.Cells(2 + h, 2))
10:
Next h