Moving ranges to copy and paste in Excel VBA -
i attempting setup macro select data worksheet(1), paste data in worksheet(2), take result worksheet(2) , paste information in worksheet(3). problem having getting range move down next set of data copy worksheet(1) getting results worksheet(2) paste in row below last result in worksheet(3).
it seems code have tried doesn't move new data copy , doesn't allow enough time pass before copying result of equation in worksheet(2). below code have attempted doesn't work:
sub copy_paste_mlr_10() application.screenupdating = false dim y integer, x integer, integer 'copy data equations = 4 255 y = x = + 10 sheets("qdata").range("g4:g14").copy _ destination:=sheets("r10").range("a5") sheets("qdata").range("oi:oi+10").copy _ destination:=sheets("r10").range("c5") sheets("qdata").range("wi:wi+10").copy _ destination:=sheets("rlr10").range("d5") sheets("qdata").range("ac4:ac14").copy _ destination:=sheets("r10").range("e5") sheets("qdata").range("an4:an14").copy _ destination:=sheets("r10").range("f5") sheets("qdata").range("ba4:ba14").copy _ destination:=sheets("r10").range("g5") sheets("qdata").range("bi4:bi14").copy _ destination:=sheets("r10").range("h5") sheets("qdata").range("bq4:bq4").copy _ destination:=sheets("r10").range("i5") 'copy results '10 results' sheets("r10").range("j5:k5").copy sheets("10 results").range("b2:c2").pastespecial paste:=xlpastevalues sheets("r10").range("j6:k6").copy sheets("10 results").range("d2:e2").pastespecial paste:=xlpastevalues application.screenupdating = true end sub
you've got loop iterator variables you're not using them correctly. try this:
for = 4 255 y = x = + 10 sheets("qdata").range("g" & y & ":g" & x).copy _ destination:=sheets("r10").range("a" & y+1)
Comments
Post a Comment