Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display two dimensional array

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
What is the code to display the two dimensional array named "nameArray(15,30)" in sheet5 starting in cell "A1"

The result should be a sheet with 15 columns and 30 rows.

Thanks in advance
 


hi,
Code:
    Dim nameArray(15, 30), iCol As Integer, lRow As Long
    
    For iCol = 0 To UBound(nameArray, 1)
        For lRow = 0 To UBound(nameArray, 2)
            sheet5.Cells(lRow, iCol) = nameArray(iCol, lRow)
        Next
    Next


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thank you for your help.
I wil implement this code in my macro.
 
I'd replace this:
sheet5.Cells(lRow, iCol) = nameArray(iCol, lRow)
with this:
sheet5.Cells(lRow [!]+ 1[/!], iCol [!]+ 1[/!]) = nameArray(iCol, lRow)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


Just might work better. ;-)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
For variant array you can pass whole 2D array in one step:
Code:
sheet5.Cells(1,1) = nameArray

combo
 
This last option didn't work for me !
But I was set in the right direction with the other options.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top