excel - Copying and Pasting the Results of a Loop calculation using VBA -


i have vba calculation looping recalculate cells 500 (or whatever iteration is) times. each recalculation there output want record of after loop complete. have tried few different ways can't seem right. here example of have far.

private sub commandbutton1_click()    dim iteration integer, integer    iteration = range("c4")     = 1 iteration      range("c14,c15,c16,c17,c18,c19,c20").calculate      range("c20").copy      range("j" & rows.count).end(xlup).offset(1).select.pastespecial  xlpastevalues    next  end sub 

try this:

private sub commandbutton1_click()    dim iteration integer, integer    dim val variant    iteration = range("c4")     = 1 iteration        range("c14,c15,c16,c17,c18,c19,c20").calculate        val = range("c20").value         debug.print "i: " & & " val: " & val        range("j" & rows.count).end(xlup).offset(1) = val    next end sub 

if correct values not show in immediate window, problem lies elsewhere. obviously, delete debug.print statement, if code works expected.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -