Copy and paste selected cells only

PJFry

New Member
Joined
Feb 9, 2018
Messages
6
Hi. I want to copy certain cells from a row and paste them in the corresponding row numbers, but in another column.
For example, I want to copy cells A1, A7, A28, A2000 and paste them in D1, D7, D28, D2000.
When I select cells A1, A7, A28, A2000 and paste them at D1, cells paste adjacently, together.
Is there way to do it in a way? Please, consider that cell references are given for example, it may involve lots of cells and distance between the cells in the same row can be big.
Thanks.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Welcome to the Board!

Here is a little macro that you can run that will copy any cells that you have selected to column D of the same rows.
So, just select the cells you want to copy and run the code:
Code:
Sub MyCopy()

    Dim cell As Range
    
    For Each cell In Selection
         Cells(cell.Row, "D") = cell
    Next cell
    
End Sub
 
Last edited:
Upvote 0
You can write a macro to do it but if you will not always paste the same rows of the column, you need to first identify which cells you will copy.

Example to copy from A1 and paste in D1:

Code:
Sub CopyPaste()
    Range("A1").Copy Range("D1")
End Sub

You can use loops for multiple copying and pasting and a variable to hold the row numbers. You didn't give enough info to describe what the code would be so you must determine the logic of selecting rows.
 
Upvote 0
you must determine the logic of selecting rows.
Not necessarily. It can be dynamic, based on whatever they have selected (see my reply above).
That will handle ALL of the cells that they have selected.
 
Upvote 0
Thank you, it works!
Is there also a way or trick to do this via the buttons/excel interface without macros?
 
Upvote 0
Not necessarily. It can be dynamic, based on whatever they have selected (see my reply above).
That will handle ALL of the cells that they have selected.

Yeah I overlooked the title of the thread. In his post he described the cells would be different distances from each other so I assumed he wanted the macro to select the cells but after I posted I saw he had said selected cells.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top