vba - Copy last two columns and insert to the left of them -
i having trouble being able copy last 2 columns data in worksheet , insert same columns left of them. here code far, copies correct columns pastes them right.
sub globalperformnewmonths() dim lnglastrow long thisworkbook.worksheets("global supplier performance") lnglastrow = .range("a" & .rows.count).end(xlup).row .cells(1, .columns.count).end(xltoleft).offset(,resize(lnglastrow,copy .cells(1, .columns.count).end(xltoleft).offset(, -2) columns("d:az").columnwidth = 18.43 application.cutcopymode = false end end sub
try selecting entire columns of data want. select them , insert them left of desired column.
range("d:e").select selection.copy columns("c:c").select selection.insert shift:=xltoright
Comments
Post a Comment