excel vba - copy and past last used column range into next column range -


i new on vba , have problem on copy , past last used column in range new column range read through previous article, specific copy , past whole column next column below

private sub commandbutton1_click()   dim col integer   col = range("a1").end(xltoright).column   columns(col).copy   columns(col + 1).insert shift:=xltoright   columns(col).select   selection.copy   selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _   :=false, transpose:=false end sub 

from above code, can copy whole column next column , hard code previous column, don't know how copy range in row such as: column e, copy row 5:10. please kindly me on matter.

and 1 more thing, code change if need create macro bottom in active sheet?

private sub commandbutton1_click()   dim col integer   col = range("a1").end(xltoright).column   range(cells(5, col), cells(10, col)).copy destination:=range(cells(5, col + 1), cells(10, col + 1)) end sub 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -