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
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