Using variables to select multiple ranges in VBA Excel -
i'm trying utilize variables multiple ranges haven't figured way this. can see in code, want re-create multiple rows based on for, can't figure out how include variable "v". in other words, how can range("f"& v & ":k" &v, etc....).select
for v = 7 lastr sheets(1).select range("f7:k7,m7:q7,ae7:ai7,aw7:ba7,bo7:bs7,cg7:ck7,cy7:dj7").select selection.copy w = 2 destrow sheets("data").select range("h" & w).select selection.pastespecial paste:=xlpastevalues, transpose:=true w = w + 42 next w next v
any help appreciated
range("f1:k1,m1:q1,ae1:ai1,aw1:ba1,bo1:bs1,cg1:ck1,cy1:dj1").offset(v-1,0).copy
note there's no need select first - cvan re-create directly
excel vba excel-vba
No comments:
Post a Comment