Error 13 - Type Mismatch

KG Old Wolf

Board Regular
Joined
Sep 20, 2009
Messages
65
The code below works but I want to substitute the variables in red for the literals in blue. I can see the correct numeric values being obtained by the red variables. Yet, as soon as I substitute the red variables, I get an error 13 - type mismatch. The values in red 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
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Solved -

I needed to put a sub-index in the line of code before the offset statement to limit the macro to a single cell within the range... i.e.

' RR will hold the ROW ID from the selected record in Table_Input
RR_Count = Range("Table_Input").Cells(1, 1).Offset(BB, 1).Value

I was inadvertently telling the macro to load all cells' data from the point of the offset cell to the end.
 
Upvote 0

Forum statistics

Threads
1,215,675
Messages
6,126,153
Members
449,294
Latest member
Jitesh_Sharma

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