View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default how to import a 2-d array into excel using vba?

assume the array is named ar

dim rwcnt as long, colcnt as long
rwcnt = ubound(ar,1) - lbound(ar,1) + 1
colcnt = ubound(ar,2) - lbound(ar,2) + 1

range("B9").Resize(rwcnt,colcnt).Value = ar

--
Regards,
Tom Ogilvy


"Krussell172" wrote:

Hi, I am writing a macro in excel and I have created a 2-d array, populated
it with data, and I want to take the data from the array and put it into an
excel worksheet. I have a loop that gets each array element an puts the data
in a cell. Since my array contains a lot of data, using the loop takes a
while to put the data into the worksheet. This macro is used to update
worksheets in about 100 workbooks, so you see how I would need to optimize
this as much as possible.

Any help would be greatly appreciated.

Krussell