Display n x n array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Iwant to take an array and put the values into excel, i tried this but it
doesn't seem to work:

For i = 1 To 3
For j = 1 To 3
t3(i, j) = Rnd
Next j
Next i

Sheets("Sheets2").Range("A2:C4").Value
=Application.WorksheetFunction.Transpose(t3)

Does anyone know how to fix this?

Thanks for your help.
 
You code worked for me when I declared my variables.

Option Explicit
Sub testme01()

Dim t3(1 To 3, 1 To 3) As Double
Dim i As Long
Dim j As Long

For i = 1 To 3
For j = 1 To 3
t3(i, j) = Rnd
Next j
Next i

Sheets("Sheet2").Range("A2:C4").Value _
= Application.WorksheetFunction.Transpose(t3)

End Sub

And are you sure you spelled the name of the worksheet correctly?
 
Yes you are right -

I spelled it wrong!

Thanks

Dave Peterson said:
You code worked for me when I declared my variables.

Option Explicit
Sub testme01()

Dim t3(1 To 3, 1 To 3) As Double
Dim i As Long
Dim j As Long

For i = 1 To 3
For j = 1 To 3
t3(i, j) = Rnd
Next j
Next i

Sheets("Sheet2").Range("A2:C4").Value _
= Application.WorksheetFunction.Transpose(t3)

End Sub

And are you sure you spelled the name of the worksheet correctly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top