ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA setting Range (https://www.excelbanter.com/excel-discussion-misc-queries/58462-vba-setting-range.html)

Jeff

VBA setting Range
 
I have an array Array(1000) and I want to output the array into cells

B1:B1001

But when I use the logic

Application.Screenupdating=false
For i =1 to 1000
Range("B1").Offset(i,0).value=Array(i)
next i

It goes extremely slow. It takes about 3 minutes. Is there a fast way to
do this?

Thanks for your help

Norman Jones

VBA setting Range
 
Hi Jeff,

Try:

Range("B1").Resize(UBound(arr) - LBound(arr) + 1) = _
Application.Transpose(arr)


---
Regards,
Norman



"Jeff" wrote in message
...
I have an array Array(1000) and I want to output the array into cells

B1:B1001

But when I use the logic

Application.Screenupdating=false
For i =1 to 1000
Range("B1").Offset(i,0).value=Array(i)
next i

It goes extremely slow. It takes about 3 minutes. Is there a fast way to
do this?

Thanks for your help





All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com