macro copy help

Stout

New Member
Joined
Jun 1, 2015
Messages
8
Hi

i'm building a macro that should copy the value from "j1" on sheet1 to "a2" on sheet2 and "k1" on sheet1 to "b2" on sheet2 and so on. I've got some parts to work but not the loop how do i do that? help would be appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try:
Code:
Sub CopyRange()
    Dim lColumn As Long
    lColumn = Sheets("Sheet1").Cells(1, Columns.Count).End(xlToLeft).Column
    Sheets("Sheet1").Range(Cells(1, 10), Cells(1, lColumn)).Copy Sheets("Sheet2").Range("A2")
End Sub
 
Upvote 0
If all the cells are consecutive, and where you are pasting them to is also consecutive, you shouldn't have to copy each cell individually. You should be able to do the whole range at once. Using the Macro Recorder will give you the code you need for this.

If those assumptions aren't correct, you will need to explain your problem in more detail.
 
Upvote 0

Forum statistics

Threads
1,206,762
Messages
6,074,788
Members
446,089
Latest member
Andrew123456789

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