Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Type mismatch error

When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587

array data is declared as variant

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Type mismatch error

Hi
data should be an array e.g.

Dim data(1 to 10, 1 to 10) as double

Sometimes you need to pass arrays as variants (e.g. when trying to
copy an array to a range on a worksheet). Then you would do

Dim Variant_data as Variant
Variant_data = data

and you can access the numbers in Variant_data exactly as if it is an
array. But you MUST create data as an array FIRST and then make your
variant.

regards
Paul

On May 11, 2:26 pm, Gautam wrote:
When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587

array data is declared as variant

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Type mismatch error

the statement was not giving me an error. Tried a couple of ways of ways to
get errror 13. the only way I found of getting error 13 was to declare data
as a string
Dim data(10,10) as string.

Check the declaration of the array data.

"Gautam" wrote:

When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587

array data is declared as variant

Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Type mismatch error

Check your other post.

Gautam wrote:

When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587

array data is declared as variant

Thanks


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Type mismatch error

On May 11, 6:55 pm, Joel wrote:
the statement was not giving me an error. Tried a couple of ways of ways to
get errror 13. the only way I found of getting error 13 was to declare data
as a string
Dim data(10,10) as string.

Check the declaration of the array data.



"Gautam" wrote:
When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587


array data is declared as variant


Thanks- Hide quoted text -


- Show quoted text -


Thanks Joel
The first part of the array was indeed a string



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Type mismatch error

On May 11, 6:47 pm, wrote:
Hi
data should be an array e.g.

Dim data(1 to 10, 1 to 10) as double

Sometimes you need to pass arrays as variants (e.g. when trying to
copy an array to a range on a worksheet). Then you would do

Dim Variant_data as Variant
Variant_data = data

and you can access the numbers in Variant_data exactly as if it is an
array. But you MUST create data as an array FIRST and then make your
variant.

regards
Paul

On May 11, 2:26 pm, Gautam wrote:



When i try the following statement in a macro, i get an error 13, Type
mismatch. Could anyone solve this please
ActiveSheet.Cells(j, colcount) = (data(j, i)) / 587


array data is declared as variant


Thanks- Hide quoted text -


- Show quoted text -


Thanks Paul
The first part of the array was a string which popped an error
the other part of the code is fine

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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Type Mismatch Error Minitman Excel Discussion (Misc queries) 7 June 21st 08 02:15 AM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 09:31 AM.

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"