![]() |
Display n x n array
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. |
Display n x n array
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? Jeff wrote: 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. -- Dave Peterson |
Display n x n array
Yes you are right -
I spelled it wrong! Thanks "Dave Peterson" wrote: 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? Jeff wrote: 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. -- Dave Peterson |
All times are GMT +1. The time now is 07:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com