vba - Adding line into Excel with macro -
i have code , trying add line in when copying information accross. issue have adds line in between them , scrambles information. have template worksheet total on bottom , basicly want pushed down lines enetered.
any great
sub summurizesheets() dim ws worksheet, wssummary worksheet dim c range range("a4:d31").select selection.clearcontents application.screenupdating = false set wssummary = sheets("summary") ' set destination cell set c = wssummary.range("a4") each ws in worksheets if ws.name <> "summary" activecell.entirerow.insert ws.range("d1").copy c.pastespecial (xlpastevalues) ws.range("e4").copy c.offset(0, 1).pastespecial (xlpastevalues) ws.range("j39").copy c.offset(0, 2).pastespecial (xlpastevalues) ' move destination cell 1 row down set c = c.offset(1, 0) end if next ws application.screenupdating = true end sub
try then:
sub summurizesheets() dim ws worksheet, wssummary worksheet dim c range application.screenupdating = false set wssummary = sheets("summary") set c = wssummary.range("$a$4") each ws in worksheets if ws.name <> "summary" c.entirerow.insert xldown, xlformatfromleftorabove set c = c.offset(-1, 0) ws.range("d1").copy c.pastespecial xlpastevalues ws.range("e4").copy c.offset(0, 1).pastespecial xlpastevalues ws.range("j39").copy c.offset(0, 2).pastespecial xlpastevalues end if next ws application.screenupdating = true end sub
Comments
Post a Comment