How to cut / copy Data from one range to another range by VBA code

 Hello Readers,

Welcome to Coding by Learning !!! 😀 

In this post lets look how to copy or cut data from one range to another range by VBA code

How to copy Data from one range to another range by VBA code

Lets look at the example table in sheet named "source_data". I have a table which has list of vehicle names. Data is present in 'A' column.


Now I want to copy entire range of ‘A’ column to ‘B’ column. We know we have excel short cut Ctrl + C and Ctrl + V. But how to copy range from one range to another range by VBA code

VBA Code:


Output:

Lets run the program (press F5). We will get following output. Data from range A:A is copied and pasted in to range B:B



How to Cut Data from one range to another range by VBA code

Take the same above table as example. Data is present in entire 'A' and 'B' column.

Now I want to cut the data from range 'A:A' and paste into 'C:C' column.

We have excel short cut Ctrl + X and Ctrl + V to do the same. But how to cut data from one range to another range by VBA code

VBA code : 


Output:

Run the code (Use short cut F5). We will get following output.



Happy learning & Happy coding!!!

Comment and share this post to your friends and colleagues 😀

Comments

Popular posts from this blog

VBA Interview Questions - Part 2 - Variables and Data types

VBA Interview questions - screen updating

VBA Interview questions - Part 3 - Array concept