speedy way to set values in a range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top