excel - Multiply Entire Range By Value? -


so best way think of accomplish on large range (about 450k rows) use following sue-do code:

range("a1").copy ' a1 contains value want multiply column range("mytable[foocolumn]").pastespecial paste:=xlpasteall, operation:=xlmultiply 

now works, fact have copy , paste value seems redundant value never going change.

for each c in range("mytable[mycolumnheader]")     if isnumeric(c) , not c = ""         c.value = c.value * 453.592 ' value in a1 previos sample     end if next 

that works, slower. has loop every cell.

i tried:

with range("mytable[mycolumnheader]")     .value = .value * 453.592 end 

but received runtime error type mismatch error if there more 1 value in column.

i thought inserting column , using formular1c1 of "=r-1c * 453.592" .value = .value, shift column , overwrite seemed clunky , think slower paste multiply.

so, have better ways of accomplishing task?

sub test()      dim rngdata range      set rngdata = thisworkbook.worksheets("sheet1").range("a1:b10")     rngdata = evaluate(rngdata.address & "*2") end sub 

kind of outdated looking ?


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -