Writing Single Dimension Array to Active Sheet

F

Fid

I have a single dimension array DataHolder(CellCount) where CellCount =
the number of items in the array.

I want to write the entire contents of the array to C1002 to Cxxxx on
the active sheet where xxxx depends on the length of the array.

I have tried

Range(Cells(1002, 3), Cells(1002 + cellcount, 3)) = DataHolder

but it writes the only value at DataHolder(1) in every cell instead of
all the values in the array.

What am I doing wrong?

Thanks,

Brent
 
J

Jake Marx

Hi Brent,
I have a single dimension array DataHolder(CellCount) where CellCount
= the number of items in the array.

I want to write the entire contents of the array to C1002 to Cxxxx on
the active sheet where xxxx depends on the length of the array.

Range(Cells(1002, 3), Cells(1002 + cellcount, 3)) = DataHolder

but it writes the only value at DataHolder(1) in every cell instead of
all the values in the array.

If you use Application.Transpose to transpose your array, it should work:

Range(Cells(1002, 3), Cells(1002 + cellcount, 3)) = _
Application.Transpose(DataHolder)

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
A

Alan Beban

Fid said:
I have a single dimension array DataHolder(CellCount) where CellCount =
the number of items in the array.

I want to write the entire contents of the array to C1002 to Cxxxx on
the active sheet where xxxx depends on the length of the array.

I have tried

Range(Cells(1002, 3), Cells(1002 + cellcount, 3)) = DataHolder

but it writes the only value at DataHolder(1) in every cell instead of
all the values in the array.

What am I doing wrong?

Thanks,

Brent
Try

Range(Cells(1002, 3), Cells(1002 + cellcount - 1, 3)) = _
Application.Transpose(DataHolder)

Alan Beban
 

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

Top