View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
KG Old Wolf KG Old Wolf is offline
external usenet poster
 
Posts: 19
Default Run time error 13 - type mismatch

Dave -

Yes, "Table_Input" is a multi-cell table (13,040R * 5C). I had a feeling I
needed to have a Cells Property (?) in the line.

What I learned is I need to "limit" to the the cell -- I think the "offset"
basically said "From this point, consider the REST of the range as data to be
placed in the RR_Count & CC_Count variables) when all I wanted was the
contents of the cell at the offset's intersection.

Thanks for the help and the lesson!
Ken



"Dave Peterson" wrote:

Is Table_input a single cell or multiple cells?

If it's multiple cells, maybe you want:
RR_Count = Range("Table_Input").cells(1,1).Offset(BB, 2).Value

I'd add a couple of lines to make sure I could see what's in RR_Count and
CC_Count:

'right after you determine that value
msgbox "*" & RR_Count & "*"

KG Old Wolf wrote:

The code below works but I want to substitute the variables (RR_Count &
CC_Count) for the literals (25,0). I can confirm the correct numeric values
being obtained by the variables. Yet, as soon as I substitute the variables,
I get an error 13 - type mismatch. The values are always numerics and are
intended as displacement values for use by the offset.

I am still very new to VBA and may be missing something obvious. I tried DIM
RR_Count as Integer but that gave me a different error.

Thanks for any thoughts or suggestions...

================================================== ====

'
' Fill Output Detail Fields
'
For BB = 0 To 15 Step 1
'
' RR holds the ROW ID from the selected record in Table_Input
RR_Count = Range("Table_Input").Offset(BB, 2).Value
'
' CC holds the COLUMN ID from the selected record in Table_Input
CC_Count = Range("Table_Input").Offset(BB, 3).Value
'
'
Range("K1").Offset(25, 0).Value = Range("Table_Input").Offset(BB, 5).Value
'
'
'
Next BB


--

Dave Peterson