Type Mismatch Error I can't solve

empirical_psych

New Member
Joined
Aug 10, 2008
Messages
15
Hello All,
I am experiencing a type mismatch error, and I'm completely stumped.
In the code sample below, it's caused by the text in red. I've tested the values of the variables with statements like this, placed in advance, right above the error:

Worksheets("Raw").Cells(13, 13).Value = Ends

and each variable has the value I intended, and appears to be the correct type.

Here is the relevant code:


'_______________________________
Dim Ends As Integer
Dim Starts As Integer
Dim Order As String
Dim AOI As String

'stuff below is within a for loop

Ends = Worksheets("Raw").Cells(I, CelRef).Value
Starts = Worksheets("Raw").Cells(I, CelRef - 1).Value
Order = Worksheets("Raw").Cells(I, 12).Value
AOI = Worksheets("Raw").Cells(I, 11).Value

If Ends >= 0 And Order <> "First" And AOI = "Q1" Then AddQone = Ends - Starts

If Not Ends >= 0 And Order <> "First" And AOI = "Q1" Then AddQone = 0

'______________________________

I have also tried knocking out the comparisons individually, and it appears each one alone produced the mismatch error.

Any advice would be greatly appreciated!!!
-Tom
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I left this out:

CelRef = E * 2 + 13

CelRef is defined directly above where Ends is defined, and Dim'ed as an integer where the rest are dim'ed
 
Upvote 0

Forum statistics

Threads
1,215,561
Messages
6,125,533
Members
449,236
Latest member
Afua

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top