excel - Copy dynamic range and paste dynamic range with duplicate value -
i want copy , paste dynamic range. paste duplicate value each source of copy range. here code created recording macro:
sub copyrange() range("a2").select range(selection, selection.end(xltoright)).select selection.copy range("l2:s7").select activesheet.paste range("a3").select range(selection, selection.end(xltoright)).select application.cutcopymode = false selection.copy range("l8:s13").select activesheet.paste range("a4").select range(selection, selection.end(xltoright)).select application.cutcopymode = false selection.copy range("l14:s19").select activesheet.paste range("a5").select range(selection, selection.end(xltoright)).select application.cutcopymode = false selection.copy activewindow.smallscroll down:=3 range("l20:s25").select activesheet.paste end sub
this screenshot output want:
sub copypastedata() dim lrw long, lrw_2 long, x long, ractive range set ractive = activecell lrw = cells(rows.count, "a").end(xlup).row application.screenupdating = false range("k2:r" & rows.count).clearcontents = 2 lrw x = x + 1 range("a" & & ":h" & i).copy lrw_2 = cells(rows.count, "k").end(xlup).row + 1 range("k" & lrw_2).resize(6) .pastespecial xlpasteall .offset(, -1).value = x end next application.cutcopymode = false ractive.select application.screenupdating = true end sub
Comments
Post a Comment