excel vba - how to copy whole rows (absolute references) -
i have make macro copies, whole rows of excel sheet (incluiding absolute references or formulas), , pastes them in lower part acording comparison. mean have copy not content of cell, absolute reference or formula, if cell modified change reflected on part had copied cell. rows copied acording comparasion made between text in string , on cells of row going copied. tricky part far has been how copy absolute reference or formula
here code have far...
sub foo() dim long, imatches long dim atokens() string atokens = split("dcv-", ",") each cell in activesheet.range("i1:i104") if (len(cell.value) <> 0) = 0 ubound(atokens) if instr(1, cell.value, atokens(i), vbtextcompare) imatches = (imatches + 1) activesheet.rows(cell.row).copy activesheet.rows(imatches + 105) 'sheets("dp_pa 9.70 rev").rows(cell.row).copy sheets("dp_pa 9.70 rev").rows(imatches + 105) end if next end if next end sub
if want make exact copy of formula (or formulas) preserves cell references, can use like:
with worksheets("sheet1") range("a20:b21").formula = range("a1:b2").formula end
Comments
Post a Comment