- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Automatically Copy a Cell to Clipboard with a Single Click in Excel?
One of the most common tasks in Excel is to copy a cell. To copy a cell, as we all know, use the command CTRL+C or by right-clicking on it and selecting Copy. But when you need to do cell copying more often, it wastes a lot of time. We can create a shortcut for copying the cells using the VB code. The shortcut will be to copy the cell with a single click.
This tutorial will help you understand how we can automatically copy a cell to the clipboard with a single click in Excel.
Automatically Copy a Cell to Clipboard with a Single Click
Here we will insert the VBA code for the sheet, then return to the sheet to complete our task. Let us see a straightforward process to see how we can automatically copy a cell to the clipboard with a single click in Excel.
Let us consider a new Excel sheet and use the command "Alt + F11" to open the vba application, then type the below-mentioned programme into the text box as shown in the below image.
Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'Updated By Nirmal If Not Intersect(Target, Range("A1:B15")) Is Nothing Then Target.Copy End If End Sub
In the code, the range A1:B15 is the range of cells where our code will work. We can use this code to copy one cell or multiple cells at once.
Now save the workbook as a macro-enabled workbook and close the vba application using the command "Alt + Q". From now on, every time we click on a cell that is mentioned in the range of code, the data in that cell will be copied automatically. When we select any cell in the range, then it will be copied automatically.
In this tutorial, we used a simple example to demonstrate how we can automatically copy a cell to the clipboard with a single click in Excel.
Kickstart Your Career
Get certified by completing the courseGet Started