Copy, paste, then move down next row until end of data

kjfred

New Member
Joined
Jan 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Would like assistance on the following routine.

Want to start with selecting B20 (data is updated in the sheet when a cell in column B is selected), copy the updated data in K15:S15, and paste into the end of row 20, which will be column AA for this sheet, then repeat selecting the next cell in column B until there is no data left in B. So the loop would go to B21, copy, then paste, then B22 and so forth until no data left in B.

My code below works but need to make a loop until no data left to select in column B:

Sub SelectMNPasteValues()
'
' SelectMNPasteValues Macro
'

'
Range("B20").Select
Range("K15:S15").Select
Application.CutCopyMode = False
Selection.Copy

Range("AA20").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 

Attachments

  • Macro Help.png
    Macro Help.png
    101.5 KB · Views: 24

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
The fact that there is another macro in the background working at the same time makes this a little tricky, but not too insurmountable. It's not entirely clear what you're asking for though -
(1) what happens with cells B22, B23, B24, etc? Do you intend to process those as well, because they look different to the first two?
(2) You said "selecting the next cell in column B until there is no data left in B", but after B24, you have two empty cells.
If you can be more specific about which cells are to be selected and processed, it shouldn't be too difficult to help you to adjust your code.
 
Upvote 0
Can you post the code that updates K15:S15?
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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