How to Copy & Paste Using VBA
VBA (Visual Basic for Applications) is the language used to program Microsoft applications like Word, Excel, Access and Visio. It is a compilation of macros which enables the user to expand the functionality of the chosen application (in this case, Excel). For instance, the user can create applications and services from databases for the computer's desktop. Its functions slightly differ from the common Excel application. You can't use keyboard combinations in a VBA macro. To perform such simple tasks as copy and paste, you need to write special codes in the formula box. Even though it sounds a bit tricky, it's not such a hideous task.
Things You'll Need
- Microsoft Office Excel
Go to the "Macro" menu.
Turn on "Record."
Write this code in the formula box. ("A1") is the cell you want to duplicate. ("B1") is the place in which you desire to paste your information. Range("A1").Select Selection.Copy Range("B1").Select ActiveSheet.Paste
Write this code in the formula box to copy and paste an entire column. Range("A:A").Select Selection.Copy Range("B:B").Select ActiveSheet.Paste
Write this code to copy and paste an entire row from 1 to 2. Range("1:1").Select Selection.Copy Range("2:2").Select ActiveSheet.Paste
Turn off "Record."
Tips & Warnings
- Make sure you write the code exactly as it is shown in this article. If one character is missing, the whole code will be useless.