Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to import a 2-d array into excel using vba?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import web query as array? Sam_stock Excel Discussion (Misc queries) 0 April 26th 07 03:58 PM
Import Text File Directly to an Array Adrian T[_4_] Excel Programming 5 August 24th 06 07:46 AM
VBA Import of text file & Array parsing of that data Dennis Excel Discussion (Misc queries) 4 November 28th 04 10:20 PM
import array text to row data in excel nduy Excel Programming 2 January 3rd 04 09:34 AM


All times are GMT +1. The time now is 03:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"