View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
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