Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run time error 13 - type mismatch

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Run time error 13 - type mismatch

Early in the code:

Dim CC_Count as Long, RR_Count as Long

and then:

Offset(RR_Count, CC_Count)

should work
--
Gary''s Student - gsnu200905


"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run time error 13 - type mismatch

Hi -

Nope - just relocated the "Error 13 - Type Mismatch" to the earlier line of
code:


RR_Count = Range("Table_Input").Offset(BB, 2)


(I had tried that and Integer to no avail but thank you for trying!)


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

"Gary''s Student" wrote:

Early in the code:

Dim CC_Count as Long, RR_Count as Long

and then:

Offset(RR_Count, CC_Count)

should work
--
Gary''s Student - gsnu200905


"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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run time error 13 - type mismatch

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
  #5   Report Post  
Posted to microsoft.public.excel.programming
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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run time error 13 - type mismatch

But you learned that .offset said to keep the same sized range as what's being
adjusted--just move it to the right/left/up/down. Right???

KG Old Wolf wrote:

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


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run time error 13 - type mismatch

I just did.... another piece just fell into place....
Thanks Dave


"Dave Peterson" wrote:

But you learned that .offset said to keep the same sized range as what's being
adjusted--just move it to the right/left/up/down. Right???

KG Old Wolf wrote:

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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error '13': Type mismatch siamadu Excel Programming 1 April 15th 09 11:41 AM
Run time error 13, type mismatch cellist Excel Programming 7 February 8th 09 01:30 PM
Run Time error 13 type mismatch cellist Excel Programming 2 February 8th 09 02:06 AM
run time error 13 type mismatch Glenda Excel Programming 3 October 24th 07 04:40 AM
Run-Time error, type Mismatch T De Villiers[_79_] Excel Programming 1 July 31st 06 03:28 PM


All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"