View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default array values type mismatch?

You are correct - I misread your code and missed that you were only
assigning a single element of the array.

I can't image what would cause type mismatch.

for example:

Sub Tester9()
Dim myArray(1 To 5, 1 To 5)
For i = 1 To 5
For j = 1 To 5
myArray(i, j) = IIf(Rnd < 0.3, CVErr(xlErrNA), _
IIf(Rnd < 0.5, i * i, Chr(Int(Rnd * 26 + 65))))
Next
Next
For i = 1 To 5
For j = 1 To 5
sStr = sStr & "myArray(" & i & _
", " & j & ")=" & CStr(myArray(i, j)) & vbTab
Next
sStr = sStr & vbNewLine
Next
Debug.Print sStr


End Sub

worked fine for me.

Maybe your code is doing something that corrupts memory where the array is
stored.

--
Regards,
Tom Ogilvy


"bwreath " wrote in message
...
thanks for the suggestion.

I don't think it has to do with the bounds of the array.

I tried the suggested code and I got a type mismatch.

If I do

msgbox myarray(y, x) & " "
I get my original automation error.

If I do msgbox myarray(y, x) without the concatentation of the
string I don't get the error.

I also get the error if I try to something like
mystring = myarray(y, x)

thanks.


---
Message posted from http://www.ExcelForum.com/