i generate arrays external data tool , want fill cells using data in arrays. have written following code.
with thisworkbook.worksheets("data") lastrow = .cells(.rows.count, 2).end(xlup).row = lbound(price) ubound(price) .cells((lastrow + 1), 1) = price(i) .cells((lastrow + 1), 2) = quantity(i) lastrow = lastrow + 1 next end all arrays of same length , have around 25 odd arrays work with. code works fine problem facing of speed. takes me around 5-6 hours fill sheet once around 3000 length of array. please suggest best way. thank you.
you have number of arrays (25) different data (e.g. price, quantity, someotherarray) per question. per comment above.
option explicit public sub getdata() dim ws worksheet dim lastrow long dim arrprice variant dim arrqty variant set ws = sheets(3) '-- starts @ 0 index arrprice = array(50, 60, 70, 75) arrqty = array(250, 100, 50, 200) '-- change columns per needs lastrow = ws.range("b" & ws.rows.count).end(xlup).row '-- ubound + 1 because array starts @ 0 index above ws.range("b1").offset(lastrow).resize(ubound(arrprice)+1).value = application.transpose(arrprice) ws.range("b1").offset(lastrow, 1).resize(ubound(arrqty)+1).value = application.transpose(arrqty) end sub 
Comments
Post a Comment