View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] curiousgeorge408@hotmail.com is offline
external usenet poster
 
Posts: 85
Default How to copy VBA array into range of cells?

What is the syntax for copying a VBA array into a range of cells?

I know I can copy into each cell individually in a for-loop. I am
wondering if there is a way to do it en masse in a single statement.

For example:

dim xdata(10) as variant
for i = 1 to 10: xdata(i-1) = i: next i
range("a1:a10") = xdata

That does not work the way that I want. It copies xdata(0) into each
of A1:A10 instead of copying xdata(1) into A2, xdata(2) into A3, etc.
I want the latter.