Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to insert a lot of values into cells?

Hi

I have DataTable with data. I would like to insert them into Excel
worksheet. Now I'm doing this cell by cell in two loop (for). Can it be done
faster?

thanks in advance
P.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to insert a lot of values into cells?

siedem wrote:
*Hi

I have DataTable with data. I would like to insert them into Excel
worksheet. Now I'm doing this cell by cell in two loop (for). Can i
be done
faster?

thanks in advance
P. *


Hi siedem,

If the data is an arrayi2-D), you can input them to cells more fast.
If an array is 1-D, make it as 2-D, or us
Application.transpose(array).

Example:


Code
-------------------

Sub Test()
Dim arrayData(1 To 1000, 1 To 1) As Long
Dim i As Long

'Make a sample array
For i = 1 To 1000
arrayData(i, 1) = i
Next

'Input an array into cells.
Cells(1, 1).Resize(UBound(arrayData, 1), UBound(arrayData, 2)).Value = arrayData
End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to insert a lot of values into cells?

Look at the copy from recordset method of the range object. works with DAO
only in xl97, but with DAO and ADO in later versions.
--
Regards,
Tom Ogilvy

"siedem" wrote in message
...
Hi

I have DataTable with data. I would like to insert them into Excel
worksheet. Now I'm doing this cell by cell in two loop (for). Can it be

done
faster?

thanks in advance
P.




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 do I insert a pound sign infront of different values in cells tintintravels Excel Discussion (Misc queries) 6 April 3rd 23 04:42 PM
insert row when sum of values equals 100 lloydyleg11 Excel Discussion (Misc queries) 4 April 30th 09 02:04 AM
insert row when sum of values equals 100 lloydyleg11 Excel Discussion (Misc queries) 1 April 23rd 09 08:20 AM
Update of cell values after insert row? dazman Excel Worksheet Functions 2 August 23rd 05 07:07 AM
Auto insert values? Rick Excel Discussion (Misc queries) 2 March 9th 05 04:37 PM


All times are GMT +1. The time now is 02:00 AM.

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

About Us

"It's about Microsoft Excel"