speedy way to set values in a range

E

emg178

Hi
I have a list of data that I want to put into a range in excel, and I want to know the fastest way of doing it

I have tried setting each cell value. That is around 0.2 seconds per cell. I have also tried setting an array of the values, and then stepping through the array and putting the value in the range with
range_values(i) = array_values(i
This cuts it down to around 0.15 seconds per cell.

Isn't there a faster way? With 100 cells, this gets pretty slow.
 
C

Chip Pearson

You can assign an entire array to a range with one statement.
E.g.,


Range("A1:A10").Value = Application.Transpose(array_values)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



emg178 said:
Hi,
I have a list of data that I want to put into a range in excel,
and I want to know the fastest way of doing it.
I have tried setting each cell value. That is around 0.2
seconds per cell. I have also tried setting an array of the
values, and then stepping through the array and putting the value
in the range with
range_values(i) = array_values(i)
This cuts it down to around 0.15 seconds per cell.

Isn't there a faster way? With 100 cells, this gets pretty
slow.
 
A

Alan Beban

emg178 said:
Hi,
I have a list of data that I want to put into a range in excel, and I want to know the fastest way of doing it.

I have tried setting each cell value. That is around 0.2 seconds per cell. I have also tried setting an array of the values, and then stepping through the array and putting the value in the range with
range_values(i) = array_values(i)
This cuts it down to around 0.15 seconds per cell.

Isn't there a faster way? With 100 cells, this gets pretty slow.

range_values.Value = array_values

Alan Beban
 
Top