View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Muscoby Muscoby is offline
external usenet poster
 
Posts: 3
Default Keep getting "Type mismatch"

I can simulate your error only if the statement deg(h) = CDbl(.Cells(2+h,3))
cannot be resolved. In this case because of text characters in the cell.

Check the values in the cells. Is it possible there are text strings in
these cells such as a degree sign or a temperature scale (C, F, K)? The code
isn't wrong, it's just not able to execute because it cannot convert the
value in the cell into a double.

"Philosophaie" wrote:

1-Type Mismatch on:

deg(h) = CDbl(.Cells(2 + h, 3))

2- h is an integer

3- With Sheets(1)...End With



"Rick Rothstein" wrote:

I told you I didn't think those two items were the source of your problem...
I just wanted you to be aware of them for your future programming efforts.

However.... you didn't answer any of the questions I asked. Here they are
again...

1. Which line of code is registering the Type Mismatch error (that is, which
line is the debugger highlighting)?

2. What data type is the variable "h" declared as?

3. I also see you have "dots" in front of your Cells calls... I assume
these lines of code are within an active With...EndWith block, correct
(although, again, this shouldn't be producing a Type Mismatch error)?

--
Rick (MVP - Excel)



"Philosophaie" wrote in message
...
Did both of these. Still type mismatch error

Dim Zodiac(23) as String
Dim deg(25) As Double, min(25) As Double, sec(25) As Double, etc....
DEGt="" to DEGt=0

tried substituting varient for double - same result


.