excel - Looping through a Column in VBA to copy an entire row -


i attempting loop through column k starting @ row 14 until end. have written following code, stops working @ range("k14:") line. tried using range("k14"& rows.count) didn't either.

windows("price volatilitydm.xlsm").activate sheets("volatility static data").activate dim x single dim cell range each cell in range("k14:")     if cell.value > 0.25         sheets("volatility static data").range("b:k").copy         windows("tolerance reportdm.xslm").activate         sheets("sheet1").range("k17:q17").paste     end if next cell 

windows("price volatilitydm.xlsm").activate sheets("volatility static data").activate set sh = thisworkbook.workheets("volatility static data") ' add reference sheet simplicity dim x single dim cell range dim lastrow  lastrow = sh.cells(sh.rows.count, "k").end(xlup).row ' last row each cell in range("k14:k" & lastrow)     if cell.value > 0.25         sheets("volatility static data").range("b:k").copy         windows("tolerance reportdm.xslm").activate         sheets("sheet1").range("k17:q17").paste     end if next cell 

you need find end of range object , make sure iterate on that. see above; if there questions, let me know.


Comments