Excel VBA - Copying non-adjacent range to a different non-adjacent range -
i'm looking run through loop of data , copy across cells 1 sheet another. using "longhand" can following work :
sub update() dim template worksheet: set template = worksheets("importtemplate") dim master worksheet: set master = worksheets("master") dim long, x long master = 2 .range("a" & rows.count).end(xlup).row select case .range("a" & a).value case "s" x = template.range("a" & rows.count).end(xlup).row + 1 template.range("a" & x).value = .range("e" & a).value 'site details template.range("b" & x).value = .range("ao" & a).value 'meter details case "m" case "c" case else end select next .select end end sub
is there "better" way of doing ? there far more cells update it's not limited 2 shown example
you include
' @ start dim priorcalculationsetting long application.screenupdating = false priorcalc = application.calculation application.calculation = xlcalculationmanual ...your code here... ' @ end application.screenupdating = true application.calculation = priorcalculationsetting
Comments
Post a Comment