Friday, August 16, 2013

Copy and paste in Excel (VBA-Excel)


Copying and pasting are very easy tasks to execute on excel with VBA. For example if you want to copy the column D to paste on the column A, you can use the simple code below:



Sub copy_and_paste()
Range("D1").EntireColumn.Copy Range("A1").EntireColumn
End Sub




P.S. Once that you did not specify the worksheet, excel will assume it as the activesheet, if you want to perform the same task on a different sheet do not forget to identify it before the Range ;)

No comments: